package com.zishi.lesson02;
?
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
?
public class TestText01 {
public static void main(String[] args) {
//正常情况main只管启动
new MyFrame();
}
}
?
class MyFrame extends Frame{
public MyFrame() {
TextField textField = new TextField();
add(textField); //已经继承Frame,不需要再frame.add()
?
//监听文本框输入的文字
ActionListener myActionListenter3 = new MyActionListenter3();
textField.addActionListener(myActionListenter3);
?
//设置替换编码
textField.setEchoChar(‘*‘);
?
?
pack();
setVisible(true);
}
}
?
class MyActionListenter3 implements ActionListener{
?