diff options
author | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-06-19 03:23:37 +0200 |
---|---|---|
committer | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-06-19 03:23:37 +0200 |
commit | fe7a2bc0ee0c04171cebffbfb0d0fdd98038938b (patch) | |
tree | 80b8116bdb89ea31d14b59b253cadf0b40ccc800 /src/jrummikub/view/impl/SidePanel.java | |
parent | bf24a9279ae23336cc8e14d6e1c40f1a2a0c33a7 (diff) | |
download | JRummikub-fe7a2bc0ee0c04171cebffbfb0d0fdd98038938b.tar JRummikub-fe7a2bc0ee0c04171cebffbfb0d0fdd98038938b.zip |
Started implementing of side panel
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@480 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view/impl/SidePanel.java')
-rw-r--r-- | src/jrummikub/view/impl/SidePanel.java | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/src/jrummikub/view/impl/SidePanel.java b/src/jrummikub/view/impl/SidePanel.java new file mode 100644 index 0000000..637ac76 --- /dev/null +++ b/src/jrummikub/view/impl/SidePanel.java @@ -0,0 +1,112 @@ +package jrummikub.view.impl; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Insets; + +import javax.swing.BoxLayout; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.border.MatteBorder; + +import com.sun.org.apache.bcel.internal.generic.DMUL; + +class SidePanel extends JPanel { + RuleInfoPanel ruleInfoPanel; + PlayerListPanel playerListPanel; + JScrollPane playerListScrollPane; + + public SidePanel() { + setLayout(new GridBagLayout()); + + setBorder(new MatteBorder(0, 0, 0, 1, Color.BLACK)); + + GridBagConstraints c = new GridBagConstraints(); + + ruleInfoPanel = new RuleInfoPanel(); + c.gridx = 0; + c.gridy = 0; + c.weightx = 1; + c.fill = GridBagConstraints.BOTH; + add(ruleInfoPanel, c); + + playerListPanel = new PlayerListPanel(); + c.gridx = 0; + c.gridy = 1; + c.weighty = 1; + c.weightx = 1; + c.fill = GridBagConstraints.BOTH; + + playerListScrollPane = new JScrollPane(playerListPanel); + playerListScrollPane.setViewportBorder(null); + add(playerListScrollPane, c); + + } + + class RuleInfoPanel extends JPanel { + JLabel dummy; + + public RuleInfoPanel() { + setLayout(new GridLayout(1, 1)); + setBorder(new MatteBorder(0, 0, 1, 0, Color.GRAY)); + dummy = new JLabel( + "<html><center>All work and no play<br>makes Jack a dull boy"); + dummy.setHorizontalAlignment(JLabel.CENTER); + add(dummy); + // setPreferredSize(new Dimension(1, 50)); + } + + } + + class PlayerListItem extends JPanel { + JLabel playerName; + + public PlayerListItem() { + setLayout(new GridBagLayout()); + setBorder(new MatteBorder(1, 0, 0, 0, Color.GRAY)); + + GridBagConstraints c = new GridBagConstraints(); + c.gridx = 0; + c.gridy = 0; + c.weightx = 1; + c.fill = GridBagConstraints.HORIZONTAL; + c.insets = new Insets(5, 5, 5, 5); + + playerName = new JLabel("<html>Horst<br>> 9000 Steine"); + add(playerName, c); + } + + } + + class PlayerListPanel extends JPanel { + JPanel startSpacer; + + public PlayerListPanel() { + setBackground(Color.RED); + setLayout(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + startSpacer = new JPanel(); + c.gridx = 0; + c.gridy = 0; + c.weightx = 1; + c.weighty = 1; + c.fill = GridBagConstraints.BOTH; + add(startSpacer, c); + c.weighty = 0; + c.fill = GridBagConstraints.HORIZONTAL; + + for (int i = 1; i <= 16; i++) { + c.gridx = 0; + c.gridy = i; + add(new PlayerListItem(), c); + } + } + } + +} |