]> andersk Git - moira.git/blame - clients/regapplet/regapplet/Regapplet.java
Add a "PIN" screen that's an alternative to the six words screen;
[moira.git] / clients / regapplet / regapplet / Regapplet.java
CommitLineData
1d3501d2 1//Title: Athena Registration Applet
2//Version:
3//Copyright: Copyright (c) 1997
4//Author: Jeffrey I. Schiller
5//Company: MIT
6//Description:Applet to facilitate new user Athena account registration
7package regapplet;
8
9import java.awt.*;
10import java.io.OutputStream;
11import java.io.BufferedOutputStream;
12import java.io.BufferedInputStream;
13import java.io.InputStream;
14import java.io.IOException;
15import java.awt.event.*;
16import java.applet.*;
17import mit.cipher.MITCipherException;
18import mit.cipher.Encap;
19
20// For sockets...
21
22import java.net.Socket;
23import java.net.ServerSocket; // For debugging we are a server
24import java.util.ResourceBundle;
25
26public class Regapplet extends Applet {
27 // ResourceBundle res = ResourceBundle.getBundle("regapplet.Res");
28 static final boolean doRules = true;
29 mybundle res = new mybundle();
30 boolean isStandalone = false;
31 CardLayout cardLayout1 = new CardLayout();
32 Panel NamePanel = new Panel();
33 Label titlelabel = new Label();
34 Label FirstNameLabel = new Label();
35 Label LastNameLabel = new Label();
36 Label MiddleNameLabel = new Label();
37 Label MITIDlabel = new Label();
38 TextField FirstName = new TextField("", 30);
39 TextField LastName = new TextField("", 30);
40 TextField MiddleName = new TextField("", 1);
41 TextField MITID = new TextField("", 20); // Should only be 9, but Netscape loses
42 Panel WordPanel = new Panel();
43 TextBlock WordInstructions = new TextBlock(600,40);
44 Button NameContButton = new Button();
45 Button NameCancelButton = new Button();
46 Button WordCancelButton = new Button();
47 Button LoginCancelButton = new Button();
48 Button PasswordCancelButton = new Button();
65cca43c 49 Label WordLabel = new Label();
1d3501d2 50 TextField Word1 = new TextField("", 6);
51 TextField Word2 = new TextField("", 6);
52 TextField Word3 = new TextField("", 6);
53 TextField Word4 = new TextField("", 6);
54 TextField Word5 = new TextField("", 6);
55 TextField Word6 = new TextField("", 6);
56 Button WordContButton = new Button();
57 GridBagLayout gridBagLayout1 = new GridBagLayout();
58 GridBagLayout gridBagLayout2 = new GridBagLayout();
59 GridLayout gridLayout1 = new GridLayout(3, 1);
60 Button ExitButton = new Button();
c05c41a2 61
62 // PIN Panel.
63 Panel PinPanel = new Panel();
64 TextBlock PinInstructions = new TextBlock(600,40);
65 Button PinCancelButton = new Button();
66 Button PinContButton = new Button();
67 TextField Pin = new TextField("", 9);
68 Label PinLabel = new Label();
69 GridBagLayout gridBagLayout7 = new GridBagLayout();
70
1d3501d2 71 Panel LoginPanel = new Panel();
72 TextBlock LoginNameBanner = new TextBlock(600,30);
73 Label LoginNameLabel = new Label();
74 TextField LoginName = new TextField("", 15);
75 Button LoginContButton = new Button();
76 GridBagLayout gridBagLayout3 = new GridBagLayout();
77 Panel PasswordPanel = new Panel();
78 TextBlock PasswordBanner = new TextBlock(600,30);
79 GridBagLayout gridBagLayout4 = new GridBagLayout();
80 Label PasswordLabel1 = new Label();
81 TextField Password1 = new TextField("", 10);
82 Label PasswordLabel2 = new Label();
83 TextField Password2 = new TextField("", 10);
84 Button PasswordContButton = new Button();
85 Panel GreetingPanel = new Panel();
86 Button GreetingButton = new Button();
87 Label Greeting1 = new Label();
88 GridBagLayout gridBagLayout5 = new GridBagLayout();
89 MessagePanel mp = new MessagePanel(this);
90 BalePanel bp = new BalePanel(this);
91 GridBagLayout gridBagLayout6 = new GridBagLayout();
92 Panel RulePanel = new Panel();
93 Button RuleButton = new Button();
39a3a97a 94 TextArea Rules = new TextArea(res.getString("rules"), 20, 72);
1d3501d2 95 Label RuleBanner = new Label();
96 public Worker worker = null;
97 public Thread workthread = null;
98 public String guesslogin = "";
99
100 //Get a parameter value
101 public String getParameter(String key, String def) {
102 return isStandalone ? System.getProperty(key, def) :
103 (getParameter(key) != null ? getParameter(key) : def);
104 }
105
106 //Construct the applet
107 public Regapplet() {
108 }
109
110 //Initialize the applet
111 public void init() {
112 try { jbInit(); } catch (Exception e) { e.printStackTrace(); }
113 try {
114 this.add("MessagePanel", mp);
115 this.add("BalePanel", bp);
116 } catch (Exception e) {
117 e.printStackTrace();
118 }
119 this.setBackground(Color.white);
120 }
121
122 //Component initialization
123 public void jbInit() throws Exception{
39a3a97a 124 // this.resize(new Dimension(600, 600));
1d3501d2 125 titlelabel.setForeground(Color.red);
126 titlelabel.setFont(new Font("Helvetica", 1, 18));
127 titlelabel.setText(res.getString("welcome"));
128 titlelabel.setBackground(Color.white);
129 FirstNameLabel.setText("Please Enter your First Name");
130 FirstNameLabel.setBackground(Color.white);
131 LastNameLabel.setText("Please Enter your Last Name");
132 LastNameLabel.setBackground(Color.white);
133 MiddleNameLabel.setText("Please Enter your Middle Initial");
134 MiddleNameLabel.setBackground(Color.white);
135 MITIDlabel.setText("Please enter your MIT ID Number");
136 MITIDlabel.setBackground(Color.white);
137 WordInstructions.setText(res.getString("getw"));
138 NameContButton.setLabel("Continue");
139 NameContButton.setBackground(Color.white);
140 NameCancelButton.setLabel("Cancel");
141 NameCancelButton.setBackground(Color.white);
65cca43c 142 WordLabel.setText("Key Words:");
143 WordLabel.setBackground(Color.white);
1d3501d2 144 WordContButton.setLabel("Continue");
145 WordContButton.setBackground(Color.white);
146 WordCancelButton.setLabel("Cancel");
147 WordCancelButton.setBackground(Color.white);
c05c41a2 148
149 // PIN initialization.
150 PinInstructions.setText(res.getString("geti"));
151 PinLabel.setText("PIN:");
152 PinLabel.setBackground(Color.white);
153 PinContButton.setLabel("Continue");
154 PinContButton.setBackground(Color.white);
155 PinCancelButton.setLabel("Cancel");
156 PinCancelButton.setBackground(Color.white);
157 Pin.setEchoCharacter('*');
158
1d3501d2 159 ExitButton.setLabel("Exit");
160 ExitButton.setBackground(Color.white);
161 LoginNameLabel.setText("Chosen Login Name: ");
162 LoginNameLabel.setBackground(Color.white);
163 LoginContButton.setLabel("Continue");
164 LoginContButton.setBackground(Color.white);
165 LoginCancelButton.setLabel("Cancel");
166 LoginCancelButton.setBackground(Color.white);
167 PasswordBanner.setText(res.getString("getp"));
168 PasswordLabel1.setText("Please choose and enter a password");
169 PasswordLabel1.setBackground(Color.white);
170 Password1.setEchoCharacter('*');
171 PasswordLabel2.setText("Please enter your password again");
172 PasswordLabel2.setBackground(Color.white);
173 Password2.setEchoCharacter('*');
174 PasswordContButton.setLabel("Continue");
175 PasswordContButton.setBackground(Color.white);
176 PasswordCancelButton.setLabel("Cancel");
177 PasswordCancelButton.setBackground(Color.white);
178 PasswordPanel.setLayout(gridBagLayout4);
179 LoginPanel.setLayout(gridBagLayout3);
180 WordPanel.setLayout(gridBagLayout1);
181 NamePanel.setLayout(gridBagLayout2);
182 this.setLayout(cardLayout1);
183 this.add("NamePanel", NamePanel);
184 NamePanel.add(titlelabel);
185 gridBagLayout2.setConstraints(titlelabel, new GridBagConstraints2(0, 0, 5, 1, 0.0, 0.0
186 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(31, 24, 10, 24), 0, 0));
187 NamePanel.add(FirstNameLabel);
188 gridBagLayout2.setConstraints(FirstNameLabel, new GridBagConstraints2(0, 1, 1, 1, 0.0, 0.0
189 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 10, 0, 0), 0, 0));
190 NamePanel.add(MiddleNameLabel);
191 gridBagLayout2.setConstraints(MiddleNameLabel, new GridBagConstraints2(0, 2, 1, 1, 0.0, 0.0
192 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 10, 0, 0), 0, 0));
193 NamePanel.add(LastNameLabel);
194 gridBagLayout2.setConstraints(LastNameLabel, new GridBagConstraints2(0, 3, 1, 1, 0.0, 0.0
195 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 10, 0, 0), 0, 0));
196 NamePanel.add(MITIDlabel);
197 gridBagLayout2.setConstraints(MITIDlabel, new GridBagConstraints2(0, 4, 1, 1, 0.0, 0.0
198 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 10, 0, 0), 0, 0));
199 NamePanel.add(FirstName);
200 gridBagLayout2.setConstraints(FirstName, new GridBagConstraints2(2, 1, 3, 1, 0.0, 0.0
201 ,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 10), 0, 0));
202 NamePanel.add(MiddleName);
203 gridBagLayout2.setConstraints(MiddleName, new GridBagConstraints2(2, 2, 3, 1, 0.0, 0.0
204 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 0, 10), 0, 0));
205 NamePanel.add(LastName);
206 gridBagLayout2.setConstraints(LastName, new GridBagConstraints2(2, 3, 3, 1, 0.0, 0.0
207 ,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 10), 0, 0));
208 NamePanel.add(MITID);
209 gridBagLayout2.setConstraints(MITID, new GridBagConstraints2(2, 4, 3, 1, 0.0, 0.0
210 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 0, 10), 0, 0));
211 NamePanel.add(NameContButton);
212 gridBagLayout2.setConstraints(NameContButton, new GridBagConstraints2(2, 5, 1, 1, 0.0, 1.0
213 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(20, 10, 10, 10), 0, 0));
214 NamePanel.add(NameCancelButton);
215 gridBagLayout2.setConstraints(NameCancelButton, new GridBagConstraints2(4, 5, 1, 1, 0.0, 1.0
216 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(20, 10, 10, 10), 0, 0));
217
218 if (isStandalone) {
219 GreetingPanel.add(ExitButton);
220 gridBagLayout5.setConstraints(ExitButton, new GridBagConstraints2(5, 5, 1, 1, 0.0, 1.0
221 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(20, 10, 10, 10), 0, 0));
222 }
223 this.add("WordPanel", WordPanel);
224 WordPanel.add(WordInstructions);
225 gridBagLayout1.setConstraints(WordInstructions, new GridBagConstraints2(0, 0, 7, 1, 0.0, 0.0
226 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(19, 31, 10, 31), 0, 0));
65cca43c 227 WordPanel.add(WordLabel);
228 gridBagLayout1.setConstraints(WordLabel, new GridBagConstraints2(0, 1, 1, 2, 0.0, 0.0
1d3501d2 229 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
230 WordPanel.add(Word1);
65cca43c 231 gridBagLayout1.setConstraints(Word1, new GridBagConstraints2(1, 1, 1, 1, 0.0, 0.0
1d3501d2 232 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
233 WordPanel.add(Word2);
65cca43c 234 gridBagLayout1.setConstraints(Word2, new GridBagConstraints2(2, 1, 1, 1, 0.0, 0.0
1d3501d2 235 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
236 WordPanel.add(Word3);
65cca43c 237 gridBagLayout1.setConstraints(Word3, new GridBagConstraints2(3, 1, 1, 1, 0.0, 0.0
1d3501d2 238 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
239 WordPanel.add(Word4);
65cca43c 240 gridBagLayout1.setConstraints(Word4, new GridBagConstraints2(1, 2, 1, 1, 0.0, 0.0
1d3501d2 241 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
242 WordPanel.add(Word5);
65cca43c 243 gridBagLayout1.setConstraints(Word5, new GridBagConstraints2(2, 2, 1, 1, 0.0, 0.0
1d3501d2 244 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
245 WordPanel.add(Word6);
65cca43c 246 gridBagLayout1.setConstraints(Word6, new GridBagConstraints2(3, 2, 1, 1, 0.0, 0.0
1d3501d2 247 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
248 WordPanel.add(WordContButton);
65cca43c 249 gridBagLayout1.setConstraints(WordContButton, new GridBagConstraints2(2, 3, 2, 2, 0.0, 1.0
1d3501d2 250 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 0, 10, 0), 0, 0));
251 WordPanel.add(WordCancelButton);
65cca43c 252 gridBagLayout1.setConstraints(WordCancelButton, new GridBagConstraints2(4, 3, 2, 2, 0.0, 1.0
1d3501d2 253 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 0, 10, 0), 0, 0));
c05c41a2 254
255 this.add("PinPanel", PinPanel);
256 PinPanel.add(PinInstructions);
257 gridBagLayout7.setConstraints(PinInstructions, new GridBagConstraints2(0, 0, 4, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(20, 10, 10, 20), 0, 0));
258 PinPanel.add(PinLabel);
259 gridBagLayout7.setConstraints(PinLabel, new GridBagConstraints2(0, 1, 1, 1, 0.0, 0.0
260 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(20, 10, 0, 0), 0, 0));
261 PinPanel.add(Pin);
262 gridBagLayout7.setConstraints(Pin, new GridBagConstraints2(1, 1, 1, 1, 0.0, 0.0
263 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(20, 0, 0, 10), 2, 0));
264 PinPanel.add(PinContButton);
265 gridBagLayout7.setConstraints(PinContButton, new GridBagConstraints2(1, 2, 1, 1, 0.0, 1.0
266 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0));
267 PinPanel.add(PinCancelButton);
268 gridBagLayout7.setConstraints(PinCancelButton, new GridBagConstraints2(3, 2, 1, 1, 0.0, 1.0
269 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0));
1d3501d2 270 this.add("LoginPanel", LoginPanel);
271 LoginPanel.add(LoginNameBanner);
272 gridBagLayout3.setConstraints(LoginNameBanner, new GridBagConstraints2(0, 0, 4, 1, 0.0, 0.0
273 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(20, 10, 10, 20), 0, 0));
274 LoginPanel.add(LoginNameLabel);
275 gridBagLayout3.setConstraints(LoginNameLabel, new GridBagConstraints2(0, 1, 1, 1, 0.0, 0.0
276 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(20, 10, 0, 0), 0, 0));
277 LoginPanel.add(LoginName);
278 gridBagLayout3.setConstraints(LoginName, new GridBagConstraints2(1, 1, 1, 1, 0.0, 0.0
279 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(20, 0, 0, 10), 2, 0));
280 LoginPanel.add(LoginContButton);
281 gridBagLayout3.setConstraints(LoginContButton, new GridBagConstraints2(1, 2, 1, 1, 0.0, 1.0
282 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0));
283 LoginPanel.add(LoginCancelButton);
284 gridBagLayout3.setConstraints(LoginCancelButton, new GridBagConstraints2(3, 2, 1, 1, 0.0, 1.0
285 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0));
286 this.add("PasswordPanel", PasswordPanel);
287 PasswordPanel.add(PasswordBanner);
288 gridBagLayout4.setConstraints(PasswordBanner, new GridBagConstraints2(0, 0, 6, 1, 0.0, 0.0
289 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(20, 10, 10, 20), 0, 0));
290 PasswordPanel.add(PasswordLabel1);
291 gridBagLayout4.setConstraints(PasswordLabel1, new GridBagConstraints2(0, 1, 3, 1, 0.0, 0.0
292 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(20, 10, 0, 0), 0, 0));
293 PasswordPanel.add(Password1);
294 gridBagLayout4.setConstraints(Password1, new GridBagConstraints2(3, 1, 3, 1, 0.0, 0.0
295 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(20, 10, 0, 10), 0, 0));
296 PasswordPanel.add(PasswordLabel2);
297 gridBagLayout4.setConstraints(PasswordLabel2, new GridBagConstraints2(0, 2, 3, 1, 0.0, 0.0
298 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 10, 0, 0), 0, 0));
299 PasswordPanel.add(Password2);
300 gridBagLayout4.setConstraints(Password2, new GridBagConstraints2(3, 2, 3, 1, 0.0, 0.0
301 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 10, 0, 10), 0, 0));
302 PasswordPanel.add(PasswordContButton);
303 gridBagLayout4.setConstraints(PasswordContButton, new GridBagConstraints2(3, 4, 1, 1, 0.0, 1.0
304 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0));
305 PasswordPanel.add(PasswordCancelButton);
306 gridBagLayout4.setConstraints(PasswordCancelButton, new GridBagConstraints2(5, 4, 1, 1, 0.0, 1.0
307 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0));
308 GreetingPanel.setLayout(gridBagLayout5);
309 GreetingButton.setLabel("Start!");
310 GreetingButton.setBackground(Color.white);
311 Greeting1.setForeground(Color.red);
312 Greeting1.setFont(new Font("Dialog", 1, 18));
313 Greeting1.setText(res.getString("welcome"));
314 Greeting1.setBackground(Color.white);
315 this.add("GreetingPanel", GreetingPanel);
316 GreetingPanel.add(GreetingButton);
317 gridBagLayout5.setConstraints(GreetingButton, new GridBagConstraints2(1, 1, 1, 1, 0.0, 1.0
318 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 10, 20, 10), 0, 0));
319 GreetingPanel.add(Greeting1);
320 gridBagLayout5.setConstraints(Greeting1, new GridBagConstraints2(0, 0, 2, 1, 0.0, 0.0
321 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(20, 10, 10, 10), 0, 0));
322 RulePanel.setLayout(gridBagLayout6);
323 RuleButton.setLabel("I have read and understand the Rules of Use");
324 Rules.setBackground(Color.white);
325 RuleButton.setBackground(Color.white);
326 RuleBanner.setFont(new Font("Helvetica", 1, 14));
327 RuleBanner.setText("Please Read the Rules of Use");
328 RuleBanner.setBackground(Color.white);
329 RulePanel.add(RuleBanner);
330 gridBagLayout6.setConstraints(RuleBanner, new GridBagConstraints2(0, 0, 3, 1, 0.0, 0.0
331 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10,10, 10, 10), 0, 0));
332 RulePanel.add(Rules);
333 Rules.setEditable(false);
334 gridBagLayout6.setConstraints(Rules, new GridBagConstraints2(0, 1, 3, 1, 0.0, 0.0
335 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10,10, 10, 10), 0, 0));
336 RulePanel.add(RuleButton);
337 gridBagLayout6.setConstraints(RuleButton, new GridBagConstraints2(2, 2, 1, 1, 0.0, 1.0
338 ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10,10, 10, 10), 0, 0));
339 this.add("RulePanel", RulePanel);
340 showInit();
341 }
342
343 public void clear() {
344 LastName.setText("");
345 LoginName.setText("");
346 MiddleName.setText("");
347 FirstName.setText("");
348 MITID.setText("");
349 Password1.setText("");
350 Password2.setText("");
351 Word1.setText("");
352 Word2.setText("");
353 Word3.setText("");
354 Word4.setText("");
355 Word5.setText("");
356 Word6.setText("");
c05c41a2 357 Pin.setText("");
1d3501d2 358 guesslogin = "";
359 }
360
361 //Start the applet
362 public void start() {
363 }
364
365 //Stop the applet
366 public void stop() {
367 }
368
369 //Destroy the applet
370 public void destroy() {
371 }
372
373 //Get Applet information
374 public String getAppletInfo() {
375 return "Athena Registration Applet by Jeffrey I. Schiller 3/28/98";
376 }
377
378 //Get parameter info
379 public String[][] getParameterInfo() {
380 return null;
381 }
382
383 //Main method
384 static public void main(String[] args) {
385 Regapplet applet = new Regapplet();
386 applet.isStandalone = true;
387 Frame frame = new Frame();
388 frame.setTitle("Athena Registration Applet");
389 frame.add("Center", applet);
390 // frame.add(BorderLayout.CENTER, applet);
391 applet.init();
392 applet.start();
393 //frame.pack();
394 // frame.setSize(700,550);
39a3a97a 395 frame.resize(910,550);
1d3501d2 396 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
397 // frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
398 frame.show();
399 // frame.setVisible(true);
400 }
401
402 public void showNameDiag() {
403 cardLayout1.show(this, "NamePanel");
404 FirstName.requestFocus();
405 }
406
407 public void showWordsDiag() {
408 cardLayout1.show(this, "WordPanel");
409 Word1.requestFocus();
410 }
411
c05c41a2 412 public void showPinDiag() {
413 cardLayout1.show(this, "PinPanel");
414 Pin.requestFocus();
415 }
416
1d3501d2 417 public void showLoginDiag() {
418 if (!guesslogin.equals("")) {
419 LoginNameBanner.setText(res.getString("getl1") + "\n" + res.getString("getl2") + " " + guesslogin + "\n" + res.getString("getl3"));
420 } else {
421 LoginNameBanner.setText(res.getString("getl1") + "\n" + res.getString("getl3"));
422 }
423 cardLayout1.show(this, "LoginPanel");
424 LoginName.requestFocus();
425 }
426
427 public void showPassDiag() {
428 cardLayout1.show(this, "PasswordPanel");
429 Password1.requestFocus();
430 }
431
432 public void showRules() {
433 cardLayout1.show(this, "RulePanel");
434 RuleButton.requestFocus();
435 }
436
437 public void showInit() {
438 if (worker != null) {
439 worker.close();
440 worker = null;
441 }
442 this.clear();
443 cardLayout1.show(this, "GreetingPanel");
444 GreetingButton.requestFocus();
445 }
446
447 public void showError() {
448 showMessage(res.getString("err"));
449 }
450
451 public void showError(boolean val) {
452 showMessage(res.getString("err"), val);
453 }
454
455 public void showError1(boolean val) {
456 showMessage(res.getString("err1"), val);
457 }
458
459 public void showMessage(String mess) {
460 mp.setText(mess, false);
461 cardLayout1.show(this, "MessagePanel");
462 }
463 public void showMessage(String mess, boolean contOK) {
464 mp.setText(mess, true);
465 cardLayout1.show(this, "MessagePanel");
466 mp.requestFocus();
467 }
468
469 private void doBale() {
470 if (worker != null) {
471 worker.oldstate = worker.state;
472 cardLayout1.show(this, "BalePanel");
473 }
474 }
475
476 public boolean keyDown(Event evt, int c) {
477 // System.out.println("Applet: KeyDown: Event: " + evt.toString() + " c: " + c);
478 if (evt.target instanceof Button) {
479 if (c == 10) {
480 this.action(evt, ((Button) evt.target).getLabel());
481 return true;
482 }
483 }
484 return false;
485 }
486
487 public boolean action(Event evt, Object arg) {
488 System.err.println("action: " + evt.toString() + arg.toString());
489 if (evt.target == GreetingButton) {
490 if (worker != null) {
491 System.err.println("Worker not null when Greeting Button pressed!");
492 } else {
493 worker = new Worker(this);
494 workthread = new Thread(worker);
495 workthread.start();
496 }
497 return true;
498 } else if ((evt.target == WordContButton) ||
c05c41a2 499 (evt.target == PinContButton) ||
1d3501d2 500 (evt.target == LoginContButton) ||
501 (evt.target == PasswordContButton) ||
502 (evt.target == NameContButton) ||
503 (evt.target == MITID) ||
504 (evt.target == Word6) ||
505 (evt.target == LoginName) ||
506 (evt.target == Password2) ||
507 (evt.target == RuleButton)) {
508 workthread = new Thread(worker);
509 workthread.start();
510 return true;
511 } else if (evt.target == ExitButton) {
512 if (isStandalone) System.exit (0);
513 } else if (evt.target == NameCancelButton ||
514 evt.target == WordCancelButton ||
c05c41a2 515 evt.target == PinCancelButton ||
1d3501d2 516 evt.target == LoginCancelButton ||
517 evt.target == PasswordCancelButton) {
518 doBale();
519 return true;
520 }
521 return false;
522 }
523}
This page took 0.130692 seconds and 5 git commands to generate.