diff options
Diffstat (limited to 'src/jrummikub/view/impl/View.java')
-rw-r--r-- | src/jrummikub/view/impl/View.java | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java index b2ae7fb..e374f8c 100644 --- a/src/jrummikub/view/impl/View.java +++ b/src/jrummikub/view/impl/View.java @@ -4,15 +4,22 @@ import java.awt.Color; import java.awt.Insets; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; +import java.util.Arrays; import java.util.Collection; +import java.util.Collections; +import java.util.List; import javax.swing.JFrame; import javax.swing.JLayeredPane; import javax.swing.JPanel; import javax.swing.border.MatteBorder; +import jrummikub.model.Position; import jrummikub.model.Stone; +import jrummikub.model.StoneColor; +import jrummikub.model.StoneSet; import jrummikub.util.IEvent; +import jrummikub.util.Pair; import jrummikub.view.IHandPanel; import jrummikub.view.IPlayerPanel; import jrummikub.view.IScorePanel; @@ -90,8 +97,8 @@ public class View extends JFrame implements IView { mainLayer.add(table); playerPanel = new PlayerPanel(); - playerPanel.setBorder(new MatteBorder(PLAYER_PANEL_BORDER_WIDTH, 0, 0, - 0, Color.BLACK)); + playerPanel.setBorder(new MatteBorder(PLAYER_PANEL_BORDER_WIDTH, 0, 0, 0, + Color.BLACK)); mainLayer.add(playerPanel); startTurnPanel = new StartTurnPanel(); @@ -214,4 +221,33 @@ public class View extends JFrame implements IView { return winPanel.getEndProgramEvent(); } + @SuppressWarnings("unchecked") + private List<Pair<Stone, Position>> createDecorationStones() { + Pair<Stone, Position> stone1 = new Pair<Stone, Position>(new Stone( + StoneColor.RED), new Position(3.5f, 0)); + Pair<Stone, Position> stone2 = new Pair<Stone, Position>(new Stone(13, + StoneColor.BLACK), new Position(5, 0)); + Pair<Stone, Position> stone3 = new Pair<Stone, Position>(new Stone(13, + StoneColor.ORANGE), new Position(6, 0)); + Pair<Stone, Position> stone4 = new Pair<Stone, Position>(new Stone(13, + StoneColor.BLUE), new Position(7, 0)); + Pair<Stone, Position> stone5 = new Pair<Stone, Position>(new Stone(13, + StoneColor.RED), new Position(8, 0)); + Pair<Stone, Position> stone6 = new Pair<Stone, Position>(new Stone( + StoneColor.BLACK), new Position(9.5f, 0)); + + return Arrays.asList(stone1, stone2, stone3, stone4, stone5, stone6); + } + + @Override + public void showInterface(boolean enable) { + if (enable) { + playerPanel.showButtons(true); + } else { + List<Pair<StoneSet, Position>> emptyTable = Collections.emptyList(); + table.setStoneSets(emptyTable); + playerPanel.getHandPanel().setStones(createDecorationStones()); + playerPanel.showButtons(false); + } + } } |