import java.awt.*;
import java.awt.event.*;
class c {
public static void main(String arg[])
{
Frame f=new Frame("GridLayout");//设置框架窗口标题
f.setLayout(new GridLayout(4,4));//设置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("+"));
f.setSize(200,200);//设置组件尺寸
f.setVisible(true);//显示框架窗口
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
}