diff options
-rw-r--r-- | mock/jrummikub/view/MockSettingsPanel.java | 12 | ||||
-rw-r--r-- | src/jrummikub/view/impl/SettingsPanel.java | 371 |
2 files changed, 220 insertions, 163 deletions
diff --git a/mock/jrummikub/view/MockSettingsPanel.java b/mock/jrummikub/view/MockSettingsPanel.java index bc2901d..7780072 100644 --- a/mock/jrummikub/view/MockSettingsPanel.java +++ b/mock/jrummikub/view/MockSettingsPanel.java @@ -193,12 +193,6 @@ public class MockSettingsPanel implements ISettingsPanel { } @Override - public void setSettingsMode(boolean enable) { - // TODO Auto-generated method stub - - } - - @Override public IEvent getBackEvent() { return backEvent; } @@ -219,4 +213,10 @@ public class MockSettingsPanel implements ISettingsPanel { public IEvent getOfferGameEvent() { return offerGameEvent; } + + @Override + public void setSettingsMode(SettingsMode mode) { + // TODO Auto-generated method stub + + } } diff --git a/src/jrummikub/view/impl/SettingsPanel.java b/src/jrummikub/view/impl/SettingsPanel.java index e5f0455..273be03 100644 --- a/src/jrummikub/view/impl/SettingsPanel.java +++ b/src/jrummikub/view/impl/SettingsPanel.java @@ -10,7 +10,6 @@ import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Insets; -import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -61,7 +60,6 @@ import jrummikub.util.IEvent; import jrummikub.util.IEvent1; import jrummikub.util.IEvent2; import jrummikub.view.ISettingsPanel; -import jrummikub.view.ISettingsPanel.SettingsMode; @SuppressWarnings("serial") class SettingsPanel extends JPanel implements ISettingsPanel { @@ -80,8 +78,12 @@ class SettingsPanel extends JPanel implements ISettingsPanel { private List<PlayerSettingsPanel> playerSettingsPanels = new ArrayList<PlayerSettingsPanel>(); + private JLabel variantLabel; + private JPanel variantPanel; + private JButton setVariantDefaultButton; private JButton setVariantChildrenButton; + private JSpinner initialMeldThresholdSpinner; private JSpinner stoneSetNumberSpinner; private JSpinner highestValueSpinner; @@ -89,14 +91,23 @@ class SettingsPanel extends JPanel implements ISettingsPanel { private JSpinner jokerNumberSpinner; private JSpinner timeSpinner; private JCheckBox noLimitsBox; + private JPanel colorSelectionPanel; + private Map<StoneColor, JToggleButton> colorButtons = new HashMap<StoneColor, JToggleButton>(); + private JPanel colorLabelPanel; + + private JLabel initialMeldThresholdLabel; + private JLabel stoneSetNumberLabel; + private JLabel highestValueLabel; + private JLabel numberOfStonesDealtLabel; + private JLabel jokerNumberLabel; + private JLabel timeLabel; + private JLabel noLimitsLabel; + private JButton loadButton; private JButton networkButton; private JButton backButton; private JPanel buttonPanel; - private JPanel colorSelectionPanel; - private Map<StoneColor, JToggleButton> colorButtons = new HashMap<StoneColor, JToggleButton>(); - private Event startGameEvent = new Event(); private Event loadGameEvent = new Event(); private Event networkGameEvent = new Event(); @@ -224,37 +235,37 @@ class SettingsPanel extends JPanel implements ISettingsPanel { @Override public void setError(SettingsError error) { switch (error) { - case NO_ERROR: - errorMessageLabel.setText(" "); - break; - case DUPLICATE_PLAYER_NAME_ERROR: - errorMessageLabel - .setText("Jeder Spielername darf nur einmal verwendet werden."); - errorMessageLabel.setForeground(Color.RED); - break; - case NO_PLAYER_NAME_ERROR: - errorMessageLabel.setText("Jeder Spieler muss einen Namen haben."); - errorMessageLabel.setForeground(Color.RED); - break; - case NOT_ENOUGH_STONES_ERROR: - errorMessageLabel - .setText("Es gibt nicht genug Steine f\u00fcr die gew\u00e4hlte Spieleranzahl."); - errorMessageLabel.setForeground(Color.RED); - break; - case NOT_ENOUGH_COLORS_ERROR: - errorMessageLabel - .setText("Es m\u00fcssen mindestens drei Farben ausgew\u00e4hlt werden."); - errorMessageLabel.setForeground(Color.RED); - break; - case COMPUTER_PLAYERS_ONLY_WARNING: - errorMessageLabel.setText("Es gibt keinen menschlichen Spieler."); - errorMessageLabel.setForeground(Color.ORANGE.darker()); - break; - case TOO_HIGH_THRESHOLD_WARNING: - errorMessageLabel - .setText("Die gew\u00e4hlte Schranke ist m\u00f6glicherweise zu hoch"); - errorMessageLabel.setForeground(Color.ORANGE.darker()); - break; + case NO_ERROR: + errorMessageLabel.setText(" "); + break; + case DUPLICATE_PLAYER_NAME_ERROR: + errorMessageLabel + .setText("Jeder Spielername darf nur einmal verwendet werden."); + errorMessageLabel.setForeground(Color.RED); + break; + case NO_PLAYER_NAME_ERROR: + errorMessageLabel.setText("Jeder Spieler muss einen Namen haben."); + errorMessageLabel.setForeground(Color.RED); + break; + case NOT_ENOUGH_STONES_ERROR: + errorMessageLabel + .setText("Es gibt nicht genug Steine f\u00fcr die gew\u00e4hlte Spieleranzahl."); + errorMessageLabel.setForeground(Color.RED); + break; + case NOT_ENOUGH_COLORS_ERROR: + errorMessageLabel + .setText("Es m\u00fcssen mindestens drei Farben ausgew\u00e4hlt werden."); + errorMessageLabel.setForeground(Color.RED); + break; + case COMPUTER_PLAYERS_ONLY_WARNING: + errorMessageLabel.setText("Es gibt keinen menschlichen Spieler."); + errorMessageLabel.setForeground(Color.ORANGE.darker()); + break; + case TOO_HIGH_THRESHOLD_WARNING: + errorMessageLabel + .setText("Die gew\u00e4hlte Schranke ist m\u00f6glicherweise zu hoch"); + errorMessageLabel.setForeground(Color.ORANGE.darker()); + break; } } @@ -298,8 +309,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { @Override public void setGameSettings(GameSettings gameSettings) { - while (playerSettingsPanels.size() > gameSettings.getPlayerList() - .size()) { + while (playerSettingsPanels.size() > gameSettings.getPlayerList().size()) { removePlayerSettingsPanel(); } @@ -308,23 +318,40 @@ class SettingsPanel extends JPanel implements ISettingsPanel { if (i < playerTypeChoices.size()) { choices = playerTypeChoices.get(i); } - updatePlayerSettingsPanel(i, gameSettings.getPlayerList().get(i), - choices); + updatePlayerSettingsPanel(i, gameSettings.getPlayerList().get(i), choices); } - initialMeldThresholdSpinner.setValue(gameSettings - .getInitialMeldThreshold()); + initialMeldThresholdSpinner + .setValue(gameSettings.getInitialMeldThreshold()); stoneSetNumberSpinner.setValue(gameSettings.getStoneSetNumber()); highestValueSpinner.setValue(gameSettings.getHighestValue()); - numberOfStonesDealtSpinner.setValue(gameSettings - .getNumberOfStonesDealt()); + numberOfStonesDealtSpinner.setValue(gameSettings.getNumberOfStonesDealt()); jokerNumberSpinner.setValue(gameSettings.getJokerNumber()); timeSpinner.setValue(gameSettings.getTotalTime()); noLimitsBox.setSelected(gameSettings.isNoLimits()); + initialMeldThresholdLabel.setText(gameSettings.getInitialMeldThreshold() + + " Punkte"); + stoneSetNumberLabel.setText(Integer.toString(gameSettings + .getStoneSetNumber())); + highestValueLabel.setText(Integer.toString(gameSettings.getHighestValue())); + numberOfStonesDealtLabel.setText(Integer.toString(gameSettings + .getNumberOfStonesDealt())); + jokerNumberLabel.setText(Integer.toString(gameSettings.getJokerNumber())); + timeLabel.setText(gameSettings.getTotalTime() + " Sekunden"); + noLimitsLabel.setText(gameSettings.isNoLimits() ? "An" : "Aus"); + + colorLabelPanel.removeAll(); + for (StoneColor color : StoneColor.values()) { - colorButtons.get(color).getModel() - .setSelected(gameSettings.getStoneColors().contains(color)); + boolean contained = gameSettings.getStoneColors().contains(color); + + colorButtons.get(color).getModel().setSelected(contained); + + if (contained) { + colorLabelPanel.add(new JLabel(ImageUtil.createColorIcon( + StonePainter.getColor(color), 16, 1))); + } } playerSettingsViewport.revalidate(); @@ -342,8 +369,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { private void addPlayerSettingsPanel(int i, PlayerSettings settings, List<Type> choices) { - PlayerSettingsPanel panel = new PlayerSettingsPanel(i, settings, - choices); + PlayerSettingsPanel panel = new PlayerSettingsPanel(i, settings, choices); playerSettingsPanels.add(panel); playerSettingsViewport.add(panel, playerSettingsViewport.getComponentCount() - 1); @@ -352,8 +378,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { } private void removePlayerSettingsPanel() { - PlayerSettingsPanel p = playerSettingsPanels - .remove(playerSettingsPanels.size() - 1); + PlayerSettingsPanel p = playerSettingsPanels.remove(playerSettingsPanels + .size() - 1); playerSettingsViewport.remove(p); } @@ -375,8 +401,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { playerSettingsViewport.add(addPlayerPanel); addPlayerButton = new JButton("+"); - addPlayerButton - .setFont(addPlayerButton.getFont().deriveFont(Font.BOLD)); + addPlayerButton.setFont(addPlayerButton.getFont().deriveFont(Font.BOLD)); addPlayerButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -396,39 +421,45 @@ class SettingsPanel extends JPanel implements ISettingsPanel { GridBagLayout layout = new GridBagLayout(); optionsPanel.setLayout(layout); - int row = 0; + int row = 1; - makeOptionLabel(row, "Variante:"); - makeVariantPanel(row++); + variantLabel = new JLabel("Variante:"); + makeVariantPanel(); - makeOptionLabel(row, "Auslegeschranke:"); - initialMeldThresholdSpinner = makeOptionSpinner(row++, 1, 999, 1, + makeOptionLabel(row++, "Auslegeschranke:"); + initialMeldThresholdLabel = new JLabel(); + initialMeldThresholdSpinner = createOptionSpinner(1, 999, 1, changeInitialMeldThresholdEvent); - makeOptionLabel(row, "Anzahl Steins\u00e4tze:"); - stoneSetNumberSpinner = makeOptionSpinner(row++, 1, 999, 1, + makeOptionLabel(row++, "Anzahl Steins\u00e4tze:"); + stoneSetNumberLabel = new JLabel(); + stoneSetNumberSpinner = createOptionSpinner(1, 999, 1, changeStoneSetNumberEvent); - makeOptionLabel(row, "H\u00f6chster Steinwert:"); - highestValueSpinner = makeOptionSpinner(row++, 3, 99, 1, - changeHighestValueEvent); + makeOptionLabel(row++, "H\u00f6chster Steinwert:"); + highestValueLabel = new JLabel(); + highestValueSpinner = createOptionSpinner(3, 99, 1, changeHighestValueEvent); - makeOptionLabel(row, "Anzahl Startsteine:"); - numberOfStonesDealtSpinner = makeOptionSpinner(row++, 1, 999, 1, + makeOptionLabel(row++, "Anzahl Startsteine:"); + numberOfStonesDealtLabel = new JLabel(); + numberOfStonesDealtSpinner = createOptionSpinner(1, 999, 1, changeNumberOfStonesDealtEvent); - makeOptionLabel(row, "Jokeranzahl:"); - jokerNumberSpinner = makeOptionSpinner(row++, 1, 999, 1, - changeJokerNumberEvent); + makeOptionLabel(row++, "Jokeranzahl:"); + jokerNumberLabel = new JLabel(); + jokerNumberSpinner = createOptionSpinner(1, 999, 1, changeJokerNumberEvent); - makeOptionLabel(row, "Zeit für Spielzug:"); - timeSpinner = makeOptionSpinner(row++, 1, 999, 1, changeTimeEvent); + makeOptionLabel(row++, "Zeit für Spielzug:"); + timeLabel = new JLabel(); + timeSpinner = createOptionSpinner(1, 999, 1, changeTimeEvent); - makeOptionLabel(row, "No Limits:"); - noLimitsBox = makeOptionCheckbox(row++, changeNoLimitsEvent); + makeOptionLabel(row++, "No Limits:"); + noLimitsLabel = new JLabel(); + noLimitsBox = createOptionCheckbox(changeNoLimitsEvent); makeOptionLabel(row, "Steinfarben:"); - createColorSelectionPanel(row++); + createColorSelectionPanel(); + colorLabelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); GridBagConstraints c = new GridBagConstraints(); c.gridx = 1; @@ -439,14 +470,72 @@ class SettingsPanel extends JPanel implements ISettingsPanel { optionsPanel.add(makeFiller(), c); } - private void createColorSelectionPanel(int row) { + private void removeOptionPanelComponentsAndLabels() { + optionsPanel.remove(variantLabel); + optionsPanel.remove(variantPanel); + + optionsPanel.remove(initialMeldThresholdSpinner); + optionsPanel.remove(initialMeldThresholdLabel); + optionsPanel.remove(stoneSetNumberSpinner); + optionsPanel.remove(stoneSetNumberLabel); + optionsPanel.remove(highestValueSpinner); + optionsPanel.remove(highestValueLabel); + optionsPanel.remove(numberOfStonesDealtSpinner); + optionsPanel.remove(numberOfStonesDealtLabel); + optionsPanel.remove(jokerNumberSpinner); + optionsPanel.remove(jokerNumberLabel); + optionsPanel.remove(timeSpinner); + optionsPanel.remove(timeLabel); + optionsPanel.remove(noLimitsBox); + optionsPanel.remove(noLimitsLabel); + + optionsPanel.remove(colorSelectionPanel); + optionsPanel.remove(colorLabelPanel); + } + + private void addOptionPanelComponents() { + removeOptionPanelComponentsAndLabels(); + + int row = 0; + addOptionPanelComponent(variantLabel, true, row); + addOptionPanelComponent(variantPanel, false, row++); + addOptionPanelComponent(initialMeldThresholdSpinner, false, row++); + addOptionPanelComponent(stoneSetNumberSpinner, false, row++); + addOptionPanelComponent(highestValueSpinner, false, row++); + addOptionPanelComponent(numberOfStonesDealtSpinner, false, row++); + addOptionPanelComponent(jokerNumberSpinner, false, row++); + addOptionPanelComponent(timeSpinner, false, row++); + addOptionPanelComponent(noLimitsBox, false, row++); + addOptionPanelComponent(colorSelectionPanel, false, row++); + } + + private void addOptionPanelLabels() { + removeOptionPanelComponentsAndLabels(); + + int row = 1; + addOptionPanelComponent(initialMeldThresholdLabel, false, row++); + addOptionPanelComponent(stoneSetNumberLabel, false, row++); + addOptionPanelComponent(highestValueLabel, false, row++); + addOptionPanelComponent(numberOfStonesDealtLabel, false, row++); + addOptionPanelComponent(jokerNumberLabel, false, row++); + addOptionPanelComponent(timeLabel, false, row++); + addOptionPanelComponent(noLimitsLabel, false, row++); + addOptionPanelComponent(colorLabelPanel, false, row++); + } + + private void addOptionPanelComponent(JComponent component, boolean label, + int row) { GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.WEST; - c.gridx = 1; + c.anchor = label ? GridBagConstraints.EAST : GridBagConstraints.WEST; + c.gridx = label ? 0 : 1; c.gridy = row; + c.insets = new Insets(2, 2, 2, 2); + + optionsPanel.add(component, c); + } + private void createColorSelectionPanel() { colorSelectionPanel = new JPanel(); - optionsPanel.add(colorSelectionPanel, c); for (StoneColor color : StoneColor.values()) { createColorButton(color); @@ -482,11 +571,11 @@ class SettingsPanel extends JPanel implements ISettingsPanel { changeStoneColorsEvent.emit(colors); } - private void makeVariantPanel(int row) { - JPanel panel = makeOptionSubpanel(row, new GridLayout(1, 2, 5, 0)); + private void makeVariantPanel() { + variantPanel = new JPanel(new GridLayout(1, 2, 5, 0)); setVariantDefaultButton = new JButton("Standard"); - panel.add(setVariantDefaultButton); + variantPanel.add(setVariantDefaultButton); setVariantDefaultButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -494,7 +583,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { } }); setVariantChildrenButton = new JButton("Kinder"); - panel.add(setVariantChildrenButton); + variantPanel.add(setVariantChildrenButton); setVariantChildrenButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -503,24 +592,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { }); } - private JPanel makeOptionSubpanel(int row, LayoutManager layout) { - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.WEST; - c.gridx = 1; - c.gridy = row; - c.insets = new Insets(2, 2, 2, 2); - JPanel panel = new JPanel(layout); - optionsPanel.add(panel, c); - return panel; - } - - private JCheckBox makeOptionCheckbox(int row, - final Event1<Boolean> targetEvent) { - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.WEST; - c.gridx = 1; - c.gridy = row; - c.insets = new Insets(2, 2, 2, 2); + private JCheckBox createOptionCheckbox(final Event1<Boolean> targetEvent) { final JCheckBox box = new JCheckBox(); box.addChangeListener(new ChangeListener() { @Override @@ -528,32 +600,25 @@ class SettingsPanel extends JPanel implements ISettingsPanel { targetEvent.emit(box.isSelected()); } }); - optionsPanel.add(box, c); return box; } - private JSpinner makeOptionSpinner(int row, int min, int max, int step, + private JSpinner createOptionSpinner(int min, int max, int step, final Event1<Integer> targetEvent) { - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.WEST; - c.gridx = 1; - c.gridy = row; - c.insets = new Insets(2, 2, 2, 2); final JSpinner spinner = new JSpinner(); spinner.setModel(new SpinnerNumberModel(min, min, max, step)); - spinner.setPreferredSize(new Dimension(60, - spinner.getMinimumSize().height)); + spinner + .setPreferredSize(new Dimension(60, spinner.getMinimumSize().height)); spinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { targetEvent.emit((Integer) spinner.getValue()); } }); - optionsPanel.add(spinner, c); return spinner; } - private void makeOptionLabel(int row, String name) { + private JLabel makeOptionLabel(int row, String name) { GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.EAST; c.gridx = 0; @@ -562,6 +627,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { JLabel label = new JLabel(name); optionsPanel.add(label, c); + + return label; } SettingsPanel() { @@ -602,8 +669,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { addDefaultButtons(); - setBorder(new CompoundBorder(new LineBorder(Color.BLACK), - new EmptyBorder(10, 10, 10, 10))); + setBorder(new CompoundBorder(new LineBorder(Color.BLACK), new EmptyBorder( + 10, 10, 10, 10))); } void resetTabbedPane() { @@ -645,7 +712,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { c.gridwidth = GridBagConstraints.REMAINDER; buttonPanel.add(backButton, c); } - + private void addNetworkOfferButtons() { buttonPanel.removeAll(); GridBagConstraints c = new GridBagConstraints(); @@ -676,34 +743,27 @@ class SettingsPanel extends JPanel implements ISettingsPanel { @Override public void setSettingsMode(SettingsMode mode) { switch (mode) { - case DEFAULT: - addDefaultButtons(); - enableOptions(true); - break; - case NETWORK_SETUP: - addNetworkSetupButtons(); - enableOptions(true); - break; - case NETWORK_OFFER: - addNetworkOfferButtons(); - enableOptions(false); - break; + case DEFAULT: + addDefaultButtons(); + enableOptions(true); + break; + case NETWORK_SETUP: + addNetworkSetupButtons(); + enableOptions(true); + break; + case NETWORK_OFFER: + addNetworkOfferButtons(); + enableOptions(false); + break; } } private void enableOptions(boolean enable) { - setVariantDefaultButton.setVisible(enable); - setVariantChildrenButton.setVisible(enable); - initialMeldThresholdSpinner.setEnabled(enable); - stoneSetNumberSpinner.setEnabled(enable); - highestValueSpinner.setEnabled(enable); - numberOfStonesDealtSpinner.setEnabled(enable); - jokerNumberSpinner.setEnabled(enable); - timeSpinner.setEnabled(enable); - noLimitsBox.setEnabled(enable); - for (JToggleButton colorButton: colorButtons.values()){ - colorButton.setEnabled(enable); - } + if (enable) { + addOptionPanelComponents(); + } else { + addOptionPanelLabels(); + } } private class PlayerSettingsPanel extends JPanel { @@ -723,8 +783,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { && index < playerType.getModel().getSize()) { playerType.setSelectedIndex(index); } - colorButton.setIcon(ImageUtil.createColorIcon(settings.getColor(), - 16, 2)); + colorButton + .setIcon(ImageUtil.createColorIcon(settings.getColor(), 16, 2)); } public void setPlayerNameEditable(boolean editable) { @@ -769,15 +829,15 @@ class SettingsPanel extends JPanel implements ISettingsPanel { Vector<String> choices = new Vector<String>(); for (Type t : playerTypeChoices) { switch (t) { - case COMPUTER: - choices.add("Computer"); - break; - case HUMAN: - choices.add("Mensch"); - break; - case NETWORK: - choices.add("Netzwerk"); - break; + case COMPUTER: + choices.add("Computer"); + break; + case HUMAN: + choices.add("Mensch"); + break; + case NETWORK: + choices.add("Netzwerk"); + break; } } playerType.setModel(new DefaultComboBoxModel(choices)); @@ -798,8 +858,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { c.gridy = 0; add(colorButton, c); - nameField.getDocument().addDocumentListener( - new NameChangeListener()); + nameField.getDocument().addDocumentListener(new NameChangeListener()); c2.gridy = 0; c2.weightx = 1; c2.fill = GridBagConstraints.HORIZONTAL; @@ -814,8 +873,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { }); playerType.setPreferredSize(new Dimension(120, playerType .getPreferredSize().height)); - playerType.setMinimumSize(new Dimension(120, playerType - .getMinimumSize().height)); + playerType.setMinimumSize(new Dimension(120, + playerType.getMinimumSize().height)); add(playerType, c); removeButton = new JButton("\u00d7"); @@ -834,9 +893,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { public Dimension getPreferredSize() { Dimension preferredSize = super.getPreferredSize(); for (Component component : this.getComponents()) { - preferredSize.setSize( - preferredSize.width, - Math.max(preferredSize.height, + preferredSize + .setSize(preferredSize.width, Math.max(preferredSize.height, component.getPreferredSize().height)); } return preferredSize; @@ -846,9 +904,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { public Dimension getMaximumSize() { Dimension preferredSize = super.getPreferredSize(); for (Component component : this.getComponents()) { - preferredSize.setSize( - Integer.MAX_VALUE, - Math.max(preferredSize.height, + preferredSize + .setSize(Integer.MAX_VALUE, Math.max(preferredSize.height, component.getPreferredSize().height)); } return preferredSize; |