awt简单案例六 -文本框TextField

来源:互联网 发布:java权限框架哪个好 编辑:程序博客网 时间:2024/04/30 10:52

文本框

public class AwtTest {

//创建框架

public static void main(String[] args) {

Frame frame = new Frame("我的GUI");

frame.setLayout(null);

frame.setBounds(0,0, 300,400);

TextField txt1 = new TextField("用户名");

txt1.setBounds(40,40,120,20);

txt1.setEditable(false);

TextField txt2 = new TextField("密码");

txt2.setBounds(40,80,120,20);

txt2.setEchoChar('*');

TextField txt3 = new TextField("ceshi");

txt3.setBounds(40,120,120,20);

txt3.setEnabled(false);

frame.add(txt1);

frame.add(txt2);

frame.add(txt3);

frame.setVisible(true);

}

}