home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Button;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.TextField;
-
- public class EchoApplet extends Applet {
- TextField textField;
- Button button;
-
- public void init() {
- this.textField = new TextField("", 25);
- this.button = new Button("Change Echo");
- this.textField.setEchoCharacter('*');
- ((Container)this).add(this.textField);
- ((Container)this).add(this.button);
- }
-
- public boolean action(Event var1, Object var2) {
- if (var1.target instanceof Button) {
- this.ChangeEcho();
- }
-
- return true;
- }
-
- protected void ChangeEcho() {
- char var1 = this.textField.getEchoChar();
- if (var1 == '*') {
- this.textField.setEchoCharacter('#');
- } else if (var1 == '#') {
- this.textField.setEchoCharacter('$');
- } else {
- this.textField.setEchoCharacter('*');
- }
- }
- }
-