diff --git a/com.trollworks.gcs/src/com/trollworks/gcs/advantage/AdvantageEditor.java b/com.trollworks.gcs/src/com/trollworks/gcs/advantage/AdvantageEditor.java index bbbef7b57..ceb63ae6f 100644 --- a/com.trollworks.gcs/src/com/trollworks/gcs/advantage/AdvantageEditor.java +++ b/com.trollworks.gcs/src/com/trollworks/gcs/advantage/AdvantageEditor.java @@ -34,7 +34,6 @@ import com.trollworks.gcs.weapon.WeaponStats; import java.awt.Component; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -45,7 +44,6 @@ import java.util.List; import javax.swing.JCheckBox; import javax.swing.JComboBox; -import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -245,8 +243,8 @@ public AdvantageEditor(Advantage advantage) { panel = embedEditor(mFeatures); mTabPanel.addTab(panel.getName(), panel); mTabPanel.addTab(mModifiers.getName(), mModifiers); - mTabPanel.addTab(mMeleeWeapons.getName(), wrapInScroller(mMeleeWeapons)); - mTabPanel.addTab(mRangedWeapons.getName(), wrapInScroller(mRangedWeapons)); + mTabPanel.addTab(mMeleeWeapons.getName(), new JScrollPane(mMeleeWeapons)); + mTabPanel.addTab(mRangedWeapons.getName(), new JScrollPane(mRangedWeapons)); if (!mIsEditable) { UIUtilities.disableControls(mMeleeWeapons); @@ -268,15 +266,7 @@ public AdvantageEditor(Advantage advantage) { UIUtilities.selectTab(mTabPanel, getLastTabName()); - add(mTabPanel, new PrecisionLayoutData().setHorizontalSpan(3).setFillAlignment().setGrabSpace(true)); - } - - private JScrollPane wrapInScroller(JComponent comp) { - JScrollPane scroller = new JScrollPane(comp); - // Unclear why this next line is needed. Failure to include it, however, results in the - // scroller being sized larger than the space available. - scroller.setPreferredSize(new Dimension(10, 10)); - return scroller; + add(mTabPanel, new PrecisionLayoutData().setHorizontalSpan(3).setFillAlignment().setGrabSpace(true).setMinimumHeight(32)); } private JScrollPane createUserDescEditor() { @@ -300,7 +290,7 @@ public void changedUpdate(DocumentEvent event) { mUserDesc = editor.getText(); } }); - return wrapInScroller(editor); + return new JScrollPane(editor); } private JCheckBox createTypeCheckBox(boolean selected, String tooltip) { @@ -323,13 +313,12 @@ public void mouseClicked(MouseEvent event) { } private JScrollPane embedEditor(JPanel editor) { - JScrollPane scrollPanel = new JScrollPane(editor); - scrollPanel.setMinimumSize(new Dimension(500, 120)); - scrollPanel.setName(editor.toString()); + JScrollPane scroller = new JScrollPane(editor); + scroller.setName(editor.toString()); if (!mIsEditable) { UIUtilities.disableControls(editor); } - return scrollPanel; + return scroller; } private EditorField createField(String text, String prototype, String tooltip) { diff --git a/com.trollworks.gcs/src/com/trollworks/gcs/modifier/ModifierListEditor.java b/com.trollworks.gcs/src/com/trollworks/gcs/modifier/ModifierListEditor.java index 0d0a6d725..02a1e7e58 100644 --- a/com.trollworks.gcs/src/com/trollworks/gcs/modifier/ModifierListEditor.java +++ b/com.trollworks.gcs/src/com/trollworks/gcs/modifier/ModifierListEditor.java @@ -69,13 +69,10 @@ private void handleOutline(String cmd) { protected abstract void addColumns(Outline outline); private Component createOutline(List readOnlyModifiers, List modifiers) { - JScrollPane scroller; - OutlineModel model; - mAddButton = new IconButton(Images.ADD, I18n.Text("Add a modifier"), () -> addModifier()); mOutline = new ModifierOutline(); - model = mOutline.getModel(); + OutlineModel model = mOutline.getModel(); addColumns(mOutline); if (readOnlyModifiers != null) { @@ -92,7 +89,7 @@ private Component createOutline(List readOnlyModifiers, List } mOutline.addActionListener(this); - scroller = new JScrollPane(mOutline, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + JScrollPane scroller = new JScrollPane(mOutline, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scroller.setColumnHeaderView(mOutline.getHeaderPanel()); scroller.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, mAddButton); return scroller;