From 1b9c7c47783a0872ca3bedfad6fb120f611d354b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 15 Jun 2011 19:02:13 +0200 Subject: Start implementing color changing over network git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@442 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/view/ISettingsPanel.java | 2 ++ src/jrummikub/view/impl/SettingsPanel.java | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/jrummikub/view') diff --git a/src/jrummikub/view/ISettingsPanel.java b/src/jrummikub/view/ISettingsPanel.java index 279526a..d01129e 100644 --- a/src/jrummikub/view/ISettingsPanel.java +++ b/src/jrummikub/view/ISettingsPanel.java @@ -237,6 +237,8 @@ public interface ISettingsPanel { */ public IEvent getOfferGameEvent(); + public void setPlayerColors(Set colors); + /** * Specifies the different kinds of settings errors that can be displayed */ diff --git a/src/jrummikub/view/impl/SettingsPanel.java b/src/jrummikub/view/impl/SettingsPanel.java index d5599a1..b5a69c5 100644 --- a/src/jrummikub/view/impl/SettingsPanel.java +++ b/src/jrummikub/view/impl/SettingsPanel.java @@ -41,6 +41,7 @@ import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.JToggleButton; import javax.swing.SpinnerNumberModel; +import javax.swing.UIManager; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; @@ -67,6 +68,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { private List removeButtonsEnabled = Collections.emptyList(); private List playerNamesEditable = Collections.emptyList(); + private Set playerColors; + private SettingsMode settingsMode = SettingsMode.DEFAULT; private JTabbedPane tabbedPane; @@ -234,6 +237,11 @@ class SettingsPanel extends JPanel implements ISettingsPanel { playerTypeChoices = choices; } + @Override + public void setPlayerColors(Set colors) { + playerColors = colors; + } + @Override public void setError(SettingsError error) { switch (error) { @@ -454,7 +462,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { jokerNumberLabel = new JLabel(); jokerNumberSpinner = createOptionSpinner(1, 999, 1, changeJokerNumberEvent); - makeOptionLabel(row++, "Zeit für Spielzug:"); + makeOptionLabel(row++, "Zeit f\u00fcr Spielzug:"); timeLabel = new JLabel(); timeSpinner = createOptionSpinner(1, 999, 1, changeTimeEvent); @@ -1019,7 +1027,12 @@ class SettingsPanel extends JPanel implements ISettingsPanel { JPopupMenu menu = new JPopupMenu(); for (Color c : PLAYER_COLORS) { - add(new ColorButton(c, menu)); + if (playerColors.contains(c)) { + add(new ColorButton(c, menu)); + } else { + add(new JLabel(ImageUtil.createColorIcon( + UIManager.getColor("PopupMenu.background"), 16, 0))); + } } menu.setLayout(new BorderLayout()); -- cgit v1.2.3