summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/SidePanel.java
blob: 637ac7670d32ac75c85226138741d60bdbc76b5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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>&gt; 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);
			}
		}
	}

}