1 | public class LabelTextFieldPanel extends JPanel {↵ | | 1 | public class WizardTextField extends JPanel {↵
|
|
2 | private GridBagLayout layout;↵ | | 2 | private GridBagLayout layout;↵
|
|
3 | private int y = 0;↵ | | 3 | private int y = 0;↵
|
|
4 | public LabelTextFieldPanel() {↵ | | 4 | public WizardTextField↵
|
5 | ↵ | | 5 | () {↵
|
| | | 6 | setOpaque(false);↵
|
6 | layout = new GridBagLayout();↵ | | 7 | layout = new GridBagLayout();↵
|
7 | setLayout(layout);↵ | | 8 | setLayout(layout);↵
|
8 | }↵ | | |
|
|
9 | ↵ | | 9 | }↵
|
|
10 | public void addLabel(JComponent label) {↵ | | 10 | public void addLabel(JLabel label) {↵
|
11 | GridBagConstraints c = new GridBagConstraints();↵ | | 11 | GridBagConstraints c = new GridBagConstraints();↵
|
|
12 | c.gridx = 0;↵ | | 12 | c.gridx = 0;↵
|
13 | c.gridy = y;↵ | | 13 | c.gridy = y;↵
|
14 | c.weightx = 0.0;↵ | | 14 | c.weightx = 0.0;↵
|
15 | c.anchor = GridBagConstraints.WEST;↵ | | 15 | c.anchor = GridBagConstraints.WEST;↵
|
16 | c.fill = GridBagConstraints.HORIZONTAL;↵ | | |
|
17 | c.insets = new Insets(0, 0, 0, 11);↵ | | 16 | c.insets = new Insets(0, 0, 0, 20);↵
|
18 | layout.setConstraints(label, c);↵ | | 17 | layout.setConstraints(label, c);↵
|
19 | add(label);↵ | | 18 | add(label);↵
|
20 | }↵ | | |
|
|
21 | ↵ | | 19 | }↵
|
|
22 | public void addTextField(JComponent component) {↵ | | 20 | public void addTextField(JComponent component) {↵
|
23 | GridBagConstraints c = new GridBagConstraints();↵ | | 21 | GridBagConstraints c = new GridBagConstraints();↵
|
|
24 | c.gridx = 1;↵ | | 22 | c.gridx = 1;↵
|
25 | c.weightx = 1.0;↵ | | 23 | c.weightx = 1.0;↵
|
26 | c.gridy = y;↵ | | 24 | c.gridy = y;↵
|
27 | c.fill = GridBagConstraints.HORIZONTAL;↵ | | 25 | c.fill = GridBagConstraints.HORIZONTAL;↵
|
28 | c.insets = new Insets(5, 0, 0, 0);↵ | | 26 | c.insets = new Insets(0, 0, 0, 0);↵
|
29 | c.anchor = GridBagConstraints.EAST;↵ | | 27 | c.anchor = GridBagConstraints.EAST;↵
|
30 | c.gridwidth = GridBagConstraints.REMAINDER;↵ | | 28 | c.gridwidth = GridBagConstraints.REMAINDER;↵
|
31 | layout.setConstraints(component, c);↵ | | 29 | layout.setConstraints(component, c);↵
|
32 | add(component);↵ | | 30 | add(component);↵
|
|
33 | y += 1;↵ | | |
|
34 | }↵ | | |
|
|
35 | public void addSeparator() {↵ | | |
|
36 | ↵ | | 31 | }↵
|
|
| | | 32 | public void addExample(JLabel example) {↵
|
| | | 33 | y += 1;↵
|
|
37 | GridBagConstraints c = new GridBagConstraints();↵ | | 34 | GridBagConstraints c = new GridBagConstraints();↵
|
38 | ↵ | | |
|
39 | c.gridx = 0;↵ | | 35 | c.gridx = 1;↵
|
40 | c.weightx = 1.0;↵ | | |
|
41 | c.gridy = y;↵ | | |
|
42 | c.fill = GridBagConstraints.HORIZONTAL;↵ | | |
|
43 | ↵ | | |
|
| | | 36 | c.gridy = y;↵
|
| | | 37 | c.weightx = 0.0;↵
|
44 | c.insets = new Insets(0, 0, 0, 0);↵ | | 38 | c.insets = new Insets(0, 10, 10, 0);↵
|
45 | c.gridwidth = GridBagConstraints.REMAINDER;↵ | | 39 | c.anchor = GridBagConstraints.↵
|
|
46 | Component component = Box.createVerticalStrut(11);↵ | | |
|
47 | ↵ | | 40 | WEST;↵
|
| | | 41 | c.fill = GridBagConstraints.NONE;↵
|
48 | layout.setConstraints(component, c);↵ | | 42 | layout.setConstraints(↵
|
49 | add(component);↵ | | |
|
|
50 | y += 1 | | 43 | example, c);↵
|
| | | 44 | add(example);↵
|
|
| | | 45 | y += 1;↵
|
| | | 46 | }↵
|
|
| | | 47 | public void addEmptyExample() {↵
|
| | | 48 | y += 2
|