import java.awt.*;
import javax.swing.*;
public class CalculaterGUI extends JFrame {
  private JPanel panel;
  private JLabel label;
  private String[] names={"7","8","9","+","4","5","6","-","1","2","3","*",
                          "0",".","=","/"};
  private JButton[] buttons=new JButton[16];

  public CalculaterGUI(String title) {
    super(title);

    label=new JLabel("    ");
    panel = new JPanel();
    panel.setLayout(new GridLayout(4,4));
    add(label,BorderLayout.NORTH );
    add(panel,BorderLayout.CENTER );

    for(int i=0;i<buttons.length;i++){
      buttons[i]=new JButton(names[i]);
      panel.add(buttons[i]);
    }
    
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    pack();
    setVisible(true);
  }
  public static void main(String args[]) {
    new CalculaterGUI("Calculater");
  }
}


/****************************************************
 * 作者：孙卫琴                                     *
 * 来源：<<Java面向对象编程>>                       *
 * 技术支持网址：www.javathinker.net                *
 ***************************************************/
