个人信息
import java.awt.*;
public class MyFrame extends Frame {
public MyFrame() //导入AWT包
{
super("我的信息"); //设置框架窗口标题
this.setSize(250,200); //设置组件尺寸
this.setLocation(300, 240); //设置组件的显示位置
this.setBackground(Color.orange); //设置组件的背景颜色
this.setLayout(new FlowLayout()); //设置容器为流布局,居中
this.add(new Label("姓名")); //创建标签,添加到框架上
this.add(new TextField("俗人",20)); //创建文本行,20列

this.add(new Label("学号"));
this.add(new TextField("15",20));
this.add(new Label("性别"));
this.add(new TextField("女",20));
this.add(new Label("班级"));
this.add(new TextField("计算机科学与技术(师范)16D",20));
this.add(new Button("OK")); //创建按钮
this.add(new Button("Cancel"));
this.setVisible(true); //显示框架窗口,必须在添加组件后
}
public static void main (String arg[]){ new MyFrame();}
}

浙公网安备 33010602011771号