1 //Title: Athena Registration Applet
3 //Copyright: Copyright (c) 1997
4 //Author: Jeffrey I. Schiller
6 //Description:Applet to facilitate new user Athena account registration
10 import java.io.OutputStream;
11 import java.io.BufferedOutputStream;
12 import java.io.BufferedInputStream;
13 import java.io.InputStream;
14 import java.io.IOException;
15 import java.awt.event.*;
17 import mit.cipher.MITCipherException;
18 import mit.cipher.Encap;
22 import java.net.Socket;
23 import java.net.ServerSocket; // For debugging we are a server
24 import java.util.ResourceBundle;
26 public 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();
49 Label WordLabel = new Label();
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();
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();
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();
94 TextArea Rules = new TextArea(res.getString("rules"), 20, 72);
95 Label RuleBanner = new Label();
96 public Worker worker = null;
97 public Thread workthread = null;
98 public String guesslogin = "";
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);
106 //Construct the applet
110 //Initialize the applet
112 try { jbInit(); } catch (Exception e) { e.printStackTrace(); }
114 this.add("MessagePanel", mp);
115 this.add("BalePanel", bp);
116 } catch (Exception e) {
119 this.setBackground(Color.white);
122 //Component initialization
123 public void jbInit() throws Exception{
124 // this.resize(new Dimension(600, 600));
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);
142 WordLabel.setText("Key Words:");
143 WordLabel.setBackground(Color.white);
144 WordContButton.setLabel("Continue");
145 WordContButton.setBackground(Color.white);
146 WordCancelButton.setLabel("Cancel");
147 WordCancelButton.setBackground(Color.white);
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('*');
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));
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));
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));
227 WordPanel.add(WordLabel);
228 gridBagLayout1.setConstraints(WordLabel, new GridBagConstraints2(0, 1, 1, 2, 0.0, 0.0
229 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
230 WordPanel.add(Word1);
231 gridBagLayout1.setConstraints(Word1, new GridBagConstraints2(1, 1, 1, 1, 0.0, 0.0
232 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
233 WordPanel.add(Word2);
234 gridBagLayout1.setConstraints(Word2, new GridBagConstraints2(2, 1, 1, 1, 0.0, 0.0
235 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
236 WordPanel.add(Word3);
237 gridBagLayout1.setConstraints(Word3, new GridBagConstraints2(3, 1, 1, 1, 0.0, 0.0
238 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
239 WordPanel.add(Word4);
240 gridBagLayout1.setConstraints(Word4, new GridBagConstraints2(1, 2, 1, 1, 0.0, 0.0
241 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
242 WordPanel.add(Word5);
243 gridBagLayout1.setConstraints(Word5, new GridBagConstraints2(2, 2, 1, 1, 0.0, 0.0
244 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
245 WordPanel.add(Word6);
246 gridBagLayout1.setConstraints(Word6, new GridBagConstraints2(3, 2, 1, 1, 0.0, 0.0
247 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
248 WordPanel.add(WordContButton);
249 gridBagLayout1.setConstraints(WordContButton, new GridBagConstraints2(2, 3, 2, 2, 0.0, 1.0
250 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 0, 10, 0), 0, 0));
251 WordPanel.add(WordCancelButton);
252 gridBagLayout1.setConstraints(WordCancelButton, new GridBagConstraints2(4, 3, 2, 2, 0.0, 1.0
253 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 0, 10, 0), 0, 0));
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));
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));
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);
343 public void clear() {
344 LastName.setText("");
345 LoginName.setText("");
346 MiddleName.setText("");
347 FirstName.setText("");
349 Password1.setText("");
350 Password2.setText("");
362 public void start() {
370 public void destroy() {
373 //Get Applet information
374 public String getAppletInfo() {
375 return "Athena Registration Applet by Jeffrey I. Schiller 3/28/98";
379 public String[][] getParameterInfo() {
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);
394 // frame.setSize(700,550);
395 frame.resize(910,550);
396 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
397 // frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
399 // frame.setVisible(true);
402 public void showNameDiag() {
403 cardLayout1.show(this, "NamePanel");
404 FirstName.requestFocus();
407 public void showWordsDiag() {
408 cardLayout1.show(this, "WordPanel");
409 Word1.requestFocus();
412 public void showPinDiag() {
413 cardLayout1.show(this, "PinPanel");
417 public void showLoginDiag() {
418 if (!guesslogin.equals("")) {
419 LoginNameBanner.setText(res.getString("getl1") + "\n" + res.getString("getl2") + " " + guesslogin + "\n" + res.getString("getl3"));
421 LoginNameBanner.setText(res.getString("getl1") + "\n" + res.getString("getl3"));
423 cardLayout1.show(this, "LoginPanel");
424 LoginName.requestFocus();
427 public void showPassDiag() {
428 cardLayout1.show(this, "PasswordPanel");
429 Password1.requestFocus();
432 public void showRules() {
433 cardLayout1.show(this, "RulePanel");
434 RuleButton.requestFocus();
437 public void showInit() {
438 if (worker != null) {
443 cardLayout1.show(this, "GreetingPanel");
444 GreetingButton.requestFocus();
447 public void showError() {
448 showMessage(res.getString("err"));
451 public void showError(boolean val) {
452 showMessage(res.getString("err"), val);
455 public void showError1(boolean val) {
456 showMessage(res.getString("err1"), val);
459 public void showMessage(String mess) {
460 mp.setText(mess, false);
461 cardLayout1.show(this, "MessagePanel");
463 public void showMessage(String mess, boolean contOK) {
464 mp.setText(mess, true);
465 cardLayout1.show(this, "MessagePanel");
469 private void doBale() {
470 if (worker != null) {
471 worker.oldstate = worker.state;
472 cardLayout1.show(this, "BalePanel");
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) {
480 this.action(evt, ((Button) evt.target).getLabel());
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!");
493 worker = new Worker(this);
494 workthread = new Thread(worker);
498 } else if ((evt.target == WordContButton) ||
499 (evt.target == PinContButton) ||
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);
511 } else if (evt.target == ExitButton) {
512 if (isStandalone) System.exit (0);
513 } else if (evt.target == NameCancelButton ||
514 evt.target == WordCancelButton ||
515 evt.target == PinCancelButton ||
516 evt.target == LoginCancelButton ||
517 evt.target == PasswordCancelButton) {