summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-31 01:50:56 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-31 01:50:56 +0200
commitc004a07a4267f3320d23f3d1d2cf483cd56f40b7 (patch)
tree97ea6ce039c22c9cece01bf59a686edb0ba14d1a /src/jrummikub/view/impl
parentc78e8e64484b887cbdd2f5e903ce25828c93e08a (diff)
downloadJRummikub-c004a07a4267f3320d23f3d1d2cf483cd56f40b7.tar
JRummikub-c004a07a4267f3320d23f3d1d2cf483cd56f40b7.zip
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
Diffstat (limited to 'src/jrummikub/view/impl')
-rw-r--r--src/jrummikub/view/impl/SettingsPanel.java38
1 files changed, 35 insertions, 3 deletions
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<Integer> changeInitialMeldThresholdEvent = new Event1<Integer>();
private Event1<Integer> changeJokerNumberEvent = new Event1<Integer>();
private Event1<Integer> changeStoneSetNumberEvent = new Event1<Integer>();
+ private Event1<Integer> changeNumberOfStonesDealtEvent = new Event1<Integer>();
+ private Event1<Integer> changeHighestValueEvent = new Event1<Integer>();
+ private Event1<Set<StoneColor>> changeStoneColorsEvent = new Event1<Set<StoneColor>>();
@Override
public IEvent getStartGameEvent() {
@@ -114,6 +121,21 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
}
@Override
+ public IEvent1<Integer> getChangeNumberOfStonesDealtEvent() {
+ return changeNumberOfStonesDealtEvent;
+ }
+
+ @Override
+ public IEvent1<Integer> getChangeHighestValueEvent() {
+ return changeHighestValueEvent;
+ }
+
+ @Override
+ public IEvent1<Set<StoneColor>> getChangeStoneColorsEvent() {
+ return changeStoneColorsEvent;
+ }
+
+ @Override
public void setError(SettingsError error) {
switch (error) {
case NO_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;