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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
/* */ package NET.worlds.console;
/* */
/* */ import java.awt.Button;
/* */ import java.awt.Event;
/* */ import java.awt.Font;
/* */ import java.awt.GridBagConstraints;
/* */ import java.awt.GridBagLayout;
/* */ import java.awt.Window;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class OkCancelDialog
/* */ extends PolledDialog
/* */ {
/* */ private static final long serialVersionUID = -232374191442133438L;
/* 38 */ protected Button okButton = new Button(Console.message("OK"));
/* 39 */ protected Button cancelButton = new Button(Console.message("Cancel"));
/* 40 */ protected GridBagLayout gbag = new GridBagLayout();
/* */
/* */ private String prompt;
/* */
/* 44 */ protected int cancelKey = 27;
/* 45 */ protected int confirmKey = 10;
/* */
/* 47 */ protected static Font font = new Font(Console.message("GammaTextFont"),
/* 48 */ 0, 12);
/* 49 */ protected static Font bfont = new Font(Console.message("ButtonFont"),
/* 50 */ 0, 12);
/* */
/* */ protected OkCancelDialog(Window parent, String title)
/* */ {
/* 54 */ this(parent, (DialogReceiver)parent, title);
/* */ }
/* */
/* */ protected OkCancelDialog(Window parent, String title, String cancel, String ok)
/* */ {
/* 59 */ this(parent, (DialogReceiver)parent, title, cancel, ok);
/* */ }
/* */
/* */ protected OkCancelDialog(Window parent, DialogReceiver target, String title)
/* */ {
/* 64 */ this(parent, target, title, true);
/* */ }
/* */
/* */ protected OkCancelDialog(Window parent, DialogReceiver target, String title, boolean modal)
/* */ {
/* 69 */ super(parent, target, title, modal);
/* 70 */ setLayout(this.gbag);
/* */ }
/* */
/* */ protected OkCancelDialog(Window parent, DialogReceiver target, String title, String cancel, String ok)
/* */ {
/* 75 */ this(parent, target, title, cancel, ok, true);
/* */ }
/* */
/* */ protected OkCancelDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, boolean modal)
/* */ {
/* 80 */ this(parent, target, title, modal);
/* 81 */ if (ok != null) {
/* 82 */ this.okButton.setFont(bfont);
/* 83 */ this.okButton.setLabel(ok);
/* */ } else {
/* 85 */ this.okButton = null;
/* */ }
/* 87 */ if (cancel != null) {
/* 88 */ this.cancelButton.setFont(bfont);
/* 89 */ this.cancelButton.setLabel(cancel);
/* */ } else {
/* 91 */ this.cancelButton = null;
/* */ }
/* */ }
/* */
/* */ public OkCancelDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, String prompt) {
/* 96 */ this(parent, target, title, cancel, ok, prompt, true);
/* */ }
/* */
/* */ public OkCancelDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, String prompt, boolean modal)
/* */ {
/* 101 */ this(parent, target, title, cancel, ok, modal);
/* 102 */ this.prompt = prompt;
/* 103 */ ready();
/* */ }
/* */
/* */
/* */ public OkCancelDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, String prompt, boolean modal, int alignment)
/* */ {
/* 109 */ this(parent, target, title, cancel, ok, modal);
/* 110 */ this.prompt = prompt;
/* 111 */ setAlignment(alignment);
/* 112 */ ready();
/* */ }
/* */
/* */ protected void build()
/* */ {
/* 117 */ GridBagConstraints c = new GridBagConstraints();
/* 118 */ if (this.prompt != null) {
/* 119 */ c.weightx = 1.0D;
/* 120 */ c.weighty = 1.0D;
/* 121 */ c.gridwidth = 0;
/* 122 */ MultiLineLabel mll = new MultiLineLabel(this.prompt, 5, 5);
/* 123 */ mll.setFont(font);
/* 124 */ add(this.gbag, mll, c);
/* */ }
/* 126 */ int count = 0;
/* 127 */ if (this.okButton != null)
/* 128 */ count++;
/* 129 */ if (this.cancelButton != null)
/* 130 */ count++;
/* 131 */ c.gridwidth = count;
/* 132 */ c.weightx = 1.0D;
/* 133 */ c.weighty = 0.0D;
/* 134 */ if (this.okButton != null) {
/* 135 */ this.okButton.setFont(bfont);
/* 136 */ add(this.gbag, this.okButton, c);
/* */ }
/* 138 */ if (this.cancelButton != null) {
/* 139 */ this.cancelButton.setFont(bfont);
/* 140 */ add(this.gbag, this.cancelButton, c);
/* */ }
/* */ }
/* */
/* */ @Deprecated
/* */ public boolean action(Event event, Object what)
/* */ {
/* 147 */ Object target = event.target;
/* 148 */ if ((target == this.okButton) && (setValue()))
/* 149 */ return done(true);
/* 150 */ if (target == this.cancelButton)
/* 151 */ return done(false);
/* 152 */ return false;
/* */ }
/* */
/* */ protected boolean setValue() {
/* 156 */ return true;
/* */ }
/* */
/* */ public void setCancelKey(int key) {
/* 160 */ this.cancelKey = key;
/* */ }
/* */
/* */ public void setConfirmKey(int key) {
/* 164 */ this.confirmKey = key;
/* */ }
/* */
/* */ @Deprecated
/* */ public boolean keyDown(Event event, int key)
/* */ {
/* 170 */ if (key == this.cancelKey)
/* 171 */ return done(false);
/* 172 */ if (key == this.confirmKey)
/* */ {
/* */
/* */
/* 176 */ if (this.okButton != null) {
/* 177 */ if (setValue())
/* 178 */ return done(true);
/* */ } else
/* 180 */ return done(false);
/* */ }
/* 182 */ return super.keyDown(event, key);
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\OkCancelDialog.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|