01: package wingset;
02:
03: import org.wings.*;
04: import org.wingx.XDivision;
05:
06: import java.awt.*;
07:
08: public class XDivisionExample extends WingSetPane {
09:
10: protected SComponent createControls() {
11: return null;
12: }
13:
14: protected SComponent createExample() {
15: XDivision division = new XDivision(new SGridBagLayout());
16: division.setPreferredSize(new SDimension("290px", null));
17: division.setTitle("Person");
18:
19: GridBagConstraints labelConstraints = new GridBagConstraints();
20: labelConstraints.weightx = .4;
21: labelConstraints.gridwidth = GridBagConstraints.RELATIVE;
22: labelConstraints.insets = new Insets(0, 0, 4, 10);
23:
24: GridBagConstraints editorConstraints = new GridBagConstraints();
25: editorConstraints.weightx = .6;
26: editorConstraints.gridwidth = GridBagConstraints.RELATIVE;
27:
28: division.add(new SLabel("First Name"), labelConstraints);
29: division.add(new STextField(), editorConstraints);
30: division.add(new SLabel("Last Name"), labelConstraints);
31: division.add(new STextField(), editorConstraints);
32:
33: XDivision division2 = new XDivision(new SGridBagLayout());
34: division2.setPreferredSize(new SDimension("290px", null));
35: division2.setTitle("Address");
36:
37: division2.add(new SLabel("Street"), labelConstraints);
38: division2.add(new STextField(), editorConstraints);
39: division2.add(new SLabel("City"), labelConstraints);
40: division2.add(new STextField(), editorConstraints);
41:
42: SPanel panel = new SPanel(new SGridLayout());
43: panel.add(division);
44: panel.add(division2);
45: return panel;
46: }
47:
48: class SLabel extends org.wings.SLabel {
49: public SLabel(String text) {
50: super (text);
51: setPreferredSize(new SDimension("100px", null));
52: setHorizontalAlignment(SConstants.RIGHT_ALIGN);
53: }
54: }
55: }
|