标签:main button adapter listener border visible lis ext system
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Frame;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
public class hood{
public static void main(String arg[])
{
Frame f=new Frame("GridLayout");
f.setLayout(new GridLayout(4,4));
f.add(new Button("7"));
f.add(new Button("8"));
f.add(new Button("9"));
f.add(new Button("+"));
f.add(new Button("4"));
f.add(new Button("5"));
f.add(new Button("6"));
f.add(new Button("-"));
f.add(new Button("1"));
f.add(new Button("2"));
f.add(new Button("3"));
f.add(new Button("*"));
f.add(new Button("0"));
f.add(new Button("."));
f.add(new Button("="));
f.add(new Button("/"));
/*Frame f=new Frame("关闭窗口");
f.add(new Button("确定"),BorderLayout.WEST);*/
f.addWindowListener(new MyClose());
f.setSize(300,200);
f.setVisible(true);
}
}
class MyClose extends WindowAdapter{
public void windowClosing(WindowEvent arg0){
System.exit(0);
}
}
标签:main button adapter listener border visible lis ext system
原文地址:http://www.cnblogs.com/mjmjkk59/p/6895421.html