-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathTestUI.java
More file actions
128 lines (105 loc) · 2.94 KB
/
Copy pathTestUI.java
File metadata and controls
128 lines (105 loc) · 2.94 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package javaforce.tests;
import javaforce.*;
import javaforce.gl.*;
import javaforce.ui.*;
import javaforce.ui.theme.*;
/** TestUI
*
* @author pquiring
*/
public class TestUI implements WindowEvents {
public static UIRender render;
public static Window window;
public static void main(String[] args) {
render = new UIRender();
window = new Window();
window.create(Window.STYLE_TITLEBAR | Window.STYLE_RESIZABLE, "TestUI", 1024, 512, window);
window.show();
window.setWindowListener(new TestUI());
GL.getInstance();
window.setContent(createUI());
window.setScale(2);
render.run();
}
public static Component createUI() {
Theme.getTheme().setForeColor(Color.GREEN);
Column c = new Column();
Row r = new Row();
c.add(r);
r.add(new Label("TopLeft"));
Button b1 = new Button("Button1");
b1.setActionListner(new ActionListener() {
public void actionPerformed(Component cmp) {
b1.setText("OK1");
window.layout();
}
});
r.add(b1);
Button b2 = new Button("Button2");
b2.setEnabled(false);
b2.setActionListner(new ActionListener() {
public void actionPerformed(Component cmp) {
b2.setText("OK2");
window.layout();
}
});
r.add(b2);
ToggleButton b3 = new ToggleButton("ToggleButton");
r.add(b3);
r.add(new FlexBox());
r.add(new Label("TopRight"));
r = new Row();
c.add(r);
CheckBox b4 = new CheckBox("CheckBox");
r.add(b4);
ListBox list = new ListBox();
list.addItem("Item 1");
list.addItem("Item 2");
list.addItem("Item 3");
r.add(list);
ListBox list2 = new ListBox();
list2.addItem("Item 1");
list2.addItem("Item 2");
list2.addItem("Item 3");
list2.addItem("Item 4");
ScrollBox scroll = new ScrollBox(list2, Direction.VERTICAL);
scroll.setSize(list2.getMinWidth() + 16, list2.getItemHeight() * 2);
scroll.setStepsize(list2.getItemHeight());
r.add(scroll);
TextField tf = new TextField("Test");
tf.setSize(100, tf.getMinHeight());
r.add(tf);
TextField ptf = new TextField("");
ptf.setPassword(true);
ptf.setSize(100, ptf.getMinHeight());
r.add(ptf);
r = new Row();
c.add(r);
TextBox tb = new TextBox("Test123\nTest456");
tb.setSize(100, 100);
r.add(tb);
TextBox tb2 = new TextBox("Test123\nTest456\nTest78900000000000000000\nL1\nL2\nL3\nL4");
ScrollBox sb2 = new ScrollBox(tb2, Direction.BOTH);
sb2.setSize(116, 116);
r.add(sb2);
ComboBox cb = new ComboBox("");
cb.addItem("Item 1");
cb.addItem("Item 2");
cb.addItem("Item 3");
cb.setSize(100, 16);
cb.setEditable(true);
r.add(cb);
c.add(new FlexBox());
r = new Row();
c.add(r);
r.add(new Label("BottomLeft"));
r.add(new FlexBox());
r.add(new Label("BottomRight"));
return c;
}
public void windowResize(int x, int y) {
}
public void windowClosing() {
System.exit(0);
}
}