From c004a07a4267f3320d23f3d1d2cf483cd56f40b7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 31 May 2011 01:50:56 +0200 Subject: Make highest value and number of stones dealt settable git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@337 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/view/impl/SettingsPanel.java | 38 +++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'src/jrummikub/view/impl') diff --git a/src/jrummikub/view/impl/SettingsPanel.java b/src/jrummikub/view/impl/SettingsPanel.java index 5eb82fb..95089a3 100644 --- a/src/jrummikub/view/impl/SettingsPanel.java +++ b/src/jrummikub/view/impl/SettingsPanel.java @@ -17,6 +17,7 @@ import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Set; import javax.swing.Box; import javax.swing.BoxLayout; @@ -44,6 +45,7 @@ import jrummikub.control.turn.TurnControlFactory; import jrummikub.control.turn.TurnControlFactory.Type; import jrummikub.model.GameSettings; import jrummikub.model.PlayerSettings; +import jrummikub.model.StoneColor; import jrummikub.util.Event; import jrummikub.util.Event1; import jrummikub.util.Event2; @@ -66,6 +68,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { private JSpinner initialMeldThresholdSpinner; private JSpinner stoneSetNumberSpinner; + private JSpinner highestValueSpinner; + private JSpinner numberOfStonesDealtSpinner; private JSpinner jokerNumberSpinner; private Event startGameEvent = new Event(); @@ -77,6 +81,9 @@ class SettingsPanel extends JPanel implements ISettingsPanel { private Event1 changeInitialMeldThresholdEvent = new Event1(); private Event1 changeJokerNumberEvent = new Event1(); private Event1 changeStoneSetNumberEvent = new Event1(); + private Event1 changeNumberOfStonesDealtEvent = new Event1(); + private Event1 changeHighestValueEvent = new Event1(); + private Event1> changeStoneColorsEvent = new Event1>(); @Override public IEvent getStartGameEvent() { @@ -113,6 +120,21 @@ class SettingsPanel extends JPanel implements ISettingsPanel { return changeStoneSetNumberEvent; } + @Override + public IEvent1 getChangeNumberOfStonesDealtEvent() { + return changeNumberOfStonesDealtEvent; + } + + @Override + public IEvent1 getChangeHighestValueEvent() { + return changeHighestValueEvent; + } + + @Override + public IEvent1> getChangeStoneColorsEvent() { + return changeStoneColorsEvent; + } + @Override public void setError(SettingsError error) { switch (error) { @@ -178,6 +200,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { initialMeldThresholdSpinner.setValue(gameSettings .getInitialMeldThreshold()); stoneSetNumberSpinner.setValue(gameSettings.getStoneSetNumber()); + highestValueSpinner.setValue(gameSettings.getHighestValue()); + numberOfStonesDealtSpinner.setValue(gameSettings.getNumberOfStonesDealt()); jokerNumberSpinner.setValue(gameSettings.getJokerNumber()); playerSettingsViewport.revalidate(); @@ -251,13 +275,21 @@ class SettingsPanel extends JPanel implements ISettingsPanel { stoneSetNumberSpinner = makeOptionSpinner(1, 1, 999, 1, changeStoneSetNumberEvent); - makeOptionLabel(2, "Jokeranzahl:"); - jokerNumberSpinner = makeOptionSpinner(2, 1, 999, 1, + makeOptionLabel(2, "H\u00f6chster Steinwert:"); + highestValueSpinner = makeOptionSpinner(2, 3, 99, 1, + changeHighestValueEvent); + + makeOptionLabel(3, "Anzahl Startsteine:"); + numberOfStonesDealtSpinner = makeOptionSpinner(3, 1, 999, 1, + changeNumberOfStonesDealtEvent); + + makeOptionLabel(4, "Jokeranzahl:"); + jokerNumberSpinner = makeOptionSpinner(4, 1, 999, 1, changeJokerNumberEvent); GridBagConstraints c = new GridBagConstraints(); c.gridx = 1; - c.gridy = 3; + c.gridy = 5; c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; -- cgit v1.2.3