diff options
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r-- | src/jrummikub/view/IStoneCollectionPanel.java | 5 | ||||
-rw-r--r-- | src/jrummikub/view/IView.java | 14 | ||||
-rw-r--r-- | src/jrummikub/view/impl/SettingsPanel.java | 43 |
3 files changed, 45 insertions, 17 deletions
diff --git a/src/jrummikub/view/IStoneCollectionPanel.java b/src/jrummikub/view/IStoneCollectionPanel.java index fa3ff73..dfa15b1 100644 --- a/src/jrummikub/view/IStoneCollectionPanel.java +++ b/src/jrummikub/view/IStoneCollectionPanel.java @@ -5,5 +5,10 @@ package jrummikub.view; */ public interface IStoneCollectionPanel extends IStonePanel { + /** + * Hide stone collection + * + * @param enable + */ void setHidden(boolean enable); } diff --git a/src/jrummikub/view/IView.java b/src/jrummikub/view/IView.java index 61925fe..b84e366 100644 --- a/src/jrummikub/view/IView.java +++ b/src/jrummikub/view/IView.java @@ -254,10 +254,24 @@ public interface IView { WIN_PANEL } + /** + * Is set if a player tried to lay out less than initial meld threshold + * + * @param points + * initial meld threshold + */ void setInitialMeldError(int points); + /** + * Show stone collection + * + * @param enable + */ void setStoneCollectionHidden(boolean enable); + /** + * Is set if the player tried to modify the table without laying out first + */ void setInitialMeldFirstError(); } diff --git a/src/jrummikub/view/impl/SettingsPanel.java b/src/jrummikub/view/impl/SettingsPanel.java index b3e1604..9262ee8 100644 --- a/src/jrummikub/view/impl/SettingsPanel.java +++ b/src/jrummikub/view/impl/SettingsPanel.java @@ -334,15 +334,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { choices); } - initialMeldThresholdSpinner.setValue(gameSettings - .getInitialMeldThreshold()); - stoneSetNumberSpinner.setValue(gameSettings.getStoneSetNumber()); - highestValueSpinner.setValue(gameSettings.getHighestValue()); - numberOfStonesDealtSpinner.setValue(gameSettings - .getNumberOfStonesDealt()); - jokerNumberSpinner.setValue(gameSettings.getJokerNumber()); - timeSpinner.setValue(gameSettings.getTotalTime()); - noLimitsBox.setSelected(gameSettings.isNoLimits()); + setInitialSettingsValue(gameSettings); initialMeldThresholdLabel.setText(gameSettings .getInitialMeldThreshold() + " Punkte"); @@ -373,6 +365,18 @@ class SettingsPanel extends JPanel implements ISettingsPanel { playerSettingsViewport.revalidate(); } + private void setInitialSettingsValue(GameSettings gameSettings) { + initialMeldThresholdSpinner.setValue(gameSettings + .getInitialMeldThreshold()); + stoneSetNumberSpinner.setValue(gameSettings.getStoneSetNumber()); + highestValueSpinner.setValue(gameSettings.getHighestValue()); + numberOfStonesDealtSpinner.setValue(gameSettings + .getNumberOfStonesDealt()); + jokerNumberSpinner.setValue(gameSettings.getJokerNumber()); + timeSpinner.setValue(gameSettings.getTotalTime()); + noLimitsBox.setSelected(gameSettings.isNoLimits()); + } + private void updatePlayerSettingsPanel(int i, PlayerSettings settings, List<Type> choices) { if (i < playerSettingsPanels.size()) { @@ -445,6 +449,18 @@ class SettingsPanel extends JPanel implements ISettingsPanel { variantLabel = new JLabel("Variante:"); makeVariantPanel(); + row = makeAllOptionLabels(row); + + GridBagConstraints c = new GridBagConstraints(); + c.gridx = 1; + c.gridy = row; + c.fill = GridBagConstraints.BOTH; + c.weightx = 1; + c.weighty = 1; + optionsPanel.add(makeFiller(), c); + } + + private int makeAllOptionLabels(int row) { makeOptionLabel(row++, "Auslegeschranke:"); initialMeldThresholdLabel = new JLabel(); initialMeldThresholdSpinner = createOptionSpinner(1, 999, 1, @@ -481,14 +497,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { makeOptionLabel(row, "Steinfarben:"); createColorSelectionPanel(); colorLabelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); - - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = row; - c.fill = GridBagConstraints.BOTH; - c.weightx = 1; - c.weighty = 1; - optionsPanel.add(makeFiller(), c); + return row; } private void removeOptionPanelComponentsAndLabels() { |