Modified sidepanel layout
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@551 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
df535edb70
commit
2a553fe6a5
1 changed files with 42 additions and 37 deletions
|
@ -17,7 +17,6 @@ import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
@ -35,7 +34,6 @@ import javax.swing.border.MatteBorder;
|
||||||
|
|
||||||
import jrummikub.model.GameSettings;
|
import jrummikub.model.GameSettings;
|
||||||
import jrummikub.model.IPlayer;
|
import jrummikub.model.IPlayer;
|
||||||
import jrummikub.model.Player;
|
|
||||||
import jrummikub.model.PlayerSettings;
|
import jrummikub.model.PlayerSettings;
|
||||||
import jrummikub.view.ISidePanel;
|
import jrummikub.view.ISidePanel;
|
||||||
|
|
||||||
|
@ -162,7 +160,8 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
c.fill = GridBagConstraints.HORIZONTAL;
|
c.fill = GridBagConstraints.HORIZONTAL;
|
||||||
c.anchor = GridBagConstraints.WEST;
|
c.anchor = GridBagConstraints.WEST;
|
||||||
JLabel nameLabel = new JLabel(name + ": ");
|
JLabel nameLabel = new JLabel(name + ": ");
|
||||||
nameLabel.setPreferredSize(new Dimension(0,nameLabel.getPreferredSize().height));
|
nameLabel.setPreferredSize(new Dimension(0, nameLabel
|
||||||
|
.getPreferredSize().height));
|
||||||
panel.add(nameLabel, c);
|
panel.add(nameLabel, c);
|
||||||
JLabel label = new JLabel("");
|
JLabel label = new JLabel("");
|
||||||
label.setHorizontalAlignment(SwingConstants.RIGHT);
|
label.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
|
@ -173,7 +172,6 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
class BottomScrollPane extends JPanel {
|
class BottomScrollPane extends JPanel {
|
||||||
JComponent content;
|
JComponent content;
|
||||||
JViewport viewport;
|
JViewport viewport;
|
||||||
|
@ -322,42 +320,43 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PlayerListItem extends JPanel {
|
class PlayerListItem extends JPanel {
|
||||||
JLabel playerName;
|
|
||||||
JLabel playerStatus;
|
|
||||||
JLabel playerColor;
|
|
||||||
|
|
||||||
public PlayerListItem(IPlayer player) {
|
public PlayerListItem(IPlayer player) {
|
||||||
setLayout(new GridBagLayout());
|
setLayout(new GridBagLayout());
|
||||||
setBorder(new EmptyBorder(0, 4, 0, 4));
|
setBorder(new EmptyBorder(0, 4, 0, 4));
|
||||||
PlayerSettings settings = player.getPlayerSettings();
|
PlayerSettings settings = player.getPlayerSettings();
|
||||||
|
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
c.gridx = 0;
|
|
||||||
c.gridy = 0;
|
|
||||||
c.gridheight = gameSettings.getSeeHandSize() ? 3 : 2;
|
|
||||||
c.weighty = 1;
|
|
||||||
c.insets = new Insets(4, 4, 4, 4);
|
|
||||||
playerColor = new JLabel(ImageUtil.createColorIcon(
|
|
||||||
settings.getColor(), 12, 1));
|
|
||||||
add(playerColor, c);
|
|
||||||
|
|
||||||
c.gridx = 1;
|
c.gridx = 1;
|
||||||
c.gridy = 0;
|
c.gridy = 0;
|
||||||
c.gridheight = 1;
|
c.gridheight = 1;
|
||||||
c.gridwidth = 2;
|
c.gridwidth = 2;
|
||||||
c.weightx = 1;
|
c.weightx = 1;
|
||||||
c.fill = GridBagConstraints.HORIZONTAL;
|
c.fill = GridBagConstraints.HORIZONTAL;
|
||||||
c.insets = new Insets(2, 2, 2, 2);
|
c.insets = new Insets(4, 2, 0, 2);
|
||||||
|
|
||||||
playerName = new JLabel(settings.getName());
|
JLabel playerName = new JLabel(settings.getName());
|
||||||
|
playerName.setIcon(ImageUtil.createColorIcon(settings.getColor(),
|
||||||
|
12, 1));
|
||||||
playerName.putClientProperty("html.disable", Boolean.TRUE);
|
playerName.putClientProperty("html.disable", Boolean.TRUE);
|
||||||
add(playerName, c);
|
add(playerName, c);
|
||||||
|
|
||||||
|
addLastTurnInfo(player);
|
||||||
|
|
||||||
|
if (gameSettings.getSeeHandSize()) {
|
||||||
|
addHandSizeInfo(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addLastTurnInfo(IPlayer player) {
|
||||||
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
|
c.gridwidth = 2;
|
||||||
|
c.weightx = 1;
|
||||||
|
c.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
c.insets = new Insets(2, 2, 2, 2);
|
||||||
c.gridx = 1;
|
c.gridx = 1;
|
||||||
c.gridy = 1;
|
c.gridy = 1;
|
||||||
|
c.anchor = GridBagConstraints.WEST;
|
||||||
String status = "Stein gezogen";
|
String status = "Stein gezogen";
|
||||||
|
|
||||||
if (player.wasLastTurnInvalid()) {
|
if (player.wasLastTurnInvalid()) {
|
||||||
status = "ungültiger Zug";
|
status = "ungültiger Zug";
|
||||||
if (!player.getLaidOut()) {
|
if (!player.getLaidOut()) {
|
||||||
|
@ -369,26 +368,32 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
} else if (player.getLastTurnStoneCount() == 1) {
|
} else if (player.getLastTurnStoneCount() == 1) {
|
||||||
status = "1 Stein abgelegt";
|
status = "1 Stein abgelegt";
|
||||||
} else if (player.getLastTurnStoneCount() > 1) {
|
} else if (player.getLastTurnStoneCount() > 1) {
|
||||||
status = player.getLastTurnStoneCount() + " Steine abgelegt";
|
status = player.getLastTurnStoneCount()
|
||||||
|
+ " Steine abgelegt";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
playerStatus = new JLabel(status);
|
JLabel playerStatus = new JLabel(status);
|
||||||
add(playerStatus, c);
|
add(playerStatus, c);
|
||||||
|
}
|
||||||
if (gameSettings.getSeeHandSize()) {
|
|
||||||
JLabel handSizeLabel = new JLabel("Handsteine: ");
|
private void addHandSizeInfo(IPlayer player) {
|
||||||
JLabel handSizeInfo = new JLabel("" + player.getHand().getSize());
|
JLabel handSizeLabel = new JLabel("Handsteine: ");
|
||||||
c.gridy = 2;
|
JLabel handSizeInfo = new JLabel("" + player.getHand().getSize());
|
||||||
c.gridwidth = 1;
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
add(handSizeLabel, c);
|
c.gridx = 1;
|
||||||
|
c.gridy = 2;
|
||||||
c.gridx = 2;
|
c.weightx = 1;
|
||||||
c.weightx = 0;
|
c.gridwidth = 1;
|
||||||
c.insets = new Insets(2, 4, 2, 4);
|
c.insets = new Insets(2, 2, 2, 2);
|
||||||
c.anchor = GridBagConstraints.EAST;
|
c.anchor = GridBagConstraints.WEST;
|
||||||
add(handSizeInfo, c);
|
add(handSizeLabel, c);
|
||||||
}
|
|
||||||
|
c.gridx = 2;
|
||||||
|
c.weightx = 0;
|
||||||
|
c.insets = new Insets(2, 4, 2, 4);
|
||||||
|
c.anchor = GridBagConstraints.EAST;
|
||||||
|
add(handSizeInfo, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue