import java.awt.*;
import java.awt.event.*;
public class MyFFrame extends Frame{
TextField a,b,c;
public static void main(String args[]){
new MyFFrame("测试的窗口");
}
public MyFFrame(String s){
super(s);
a = new TextField();
b = new TextField();
c = new TextField();
Label l1 = new Label("姓名");
Label l2 = new Label("性别");
Label l3 = new Label("籍贯");
setLayout(new GridLayout(3,2));
add(l1); add(a);
add(l2);add(b);
add(l3);add(c);
pack();
setVisible(true);
addWindowListener(new WindowAdapter (){
public void windowClosing(WindowEvent e){
System.out.println("System.out!");
System.exit(0);
}
});
}
}
Tags -
java
文章来源:
http://www.tt-shopping.com/kevinlau/read.php/109.htm