From 8a3e4c3e26cba022dfaf06f8c7cd31b33b0889e9 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Mon, 20 Jun 2011 03:19:02 +0200 Subject: Finished side panel info git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@501 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/view/impl/SidePanel.java | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'src/jrummikub/view') diff --git a/src/jrummikub/view/impl/SidePanel.java b/src/jrummikub/view/impl/SidePanel.java index a4e0e43..88f5d64 100644 --- a/src/jrummikub/view/impl/SidePanel.java +++ b/src/jrummikub/view/impl/SidePanel.java @@ -63,7 +63,7 @@ class SidePanel extends JPanel implements ISidePanel { c.gridx = 0; c.gridy = 0; c.weightx = 1; - c.fill = GridBagConstraints.BOTH; + c.fill = GridBagConstraints.HORIZONTAL; infoPanel.setBorder(new MatteBorder(0, 0, 1, 0, Color.GRAY)); add(infoPanel, c); @@ -159,7 +159,9 @@ class SidePanel extends JPanel implements ISidePanel { c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; - panel.add(new JLabel(name + ": "), c); + JLabel nameLabel = new JLabel(name + ": "); + nameLabel.setPreferredSize(new Dimension(0,nameLabel.getPreferredSize().height)); + panel.add(nameLabel, c); JLabel label = new JLabel(""); label.setHorizontalAlignment(SwingConstants.RIGHT); c.weightx = 0; @@ -321,7 +323,6 @@ class SidePanel extends JPanel implements ISidePanel { JLabel playerName; JLabel playerStatus; JLabel playerColor; - public PlayerListItem(IPlayer player) { setLayout(new GridBagLayout()); @@ -343,18 +344,35 @@ class SidePanel extends JPanel implements ISidePanel { c.gridheight = 1; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; - c.insets = new Insets(2,2,2,2); + c.insets = new Insets(2, 2, 2, 2); playerName = new JLabel(settings.getName()); playerName.putClientProperty("html.disable", Boolean.TRUE); add(playerName, c); - + c.gridx = 1; c.gridy = 1; - playerStatus = new JLabel(player.getLaidOut() ? "rausgekommen" : "nicht rausgekommen"); + + String status = "Stein gezogen"; + + if (player.wasLastTurnInvalid()) { + status = "ungültiger Zug"; + if (!player.getLaidOut()) { + status = "ungültig, nicht rausgekommen"; + } + } else { + if (!player.getLaidOut()) { + status = "nicht rausgekommen"; + } else if (player.getLastTurnStoneCount() == 1) { + status = "1 Stein abgelegt"; + } else if (player.getLastTurnStoneCount() > 1) { + status = player.getLastTurnStoneCount() + " Steine abgelegt"; + } + } + + playerStatus = new JLabel(status); add(playerStatus, c); } - } class PlayerListPanel extends JPanel { -- cgit v1.2.3