diff options
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r-- | src/jrummikub/view/impl/SidePanel.java | 32 |
1 files changed, 25 insertions, 7 deletions
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 { |