package teo;
import java.awt.*;
import java.awt.event.*;
import http://www.doczj.com/doc/d43ae31a964bcf84b9d57b7c.htmlng.String;
import javax.swing.*;
public class test extends Frame{
//声明16个Button
Button btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn10, btn11, btn12, btn13, btn14,btn15,btn16;
//声明1个文本框,用于接收数字和操作
TextField numText;
//声明一个面板专门用于存放按钮
Panel btnPanel;
//构造函数初始话按钮
test(String title){
super(title);
btn1=new Button("0");
btn2=new Button("1");
btn3=new Button("2");
btn4=new Button("3");
btn5=new Button("4");
btn6=new Button("5");
btn7=new Button("6");
btn8=new Button("7");
btn9=new Button("8");
btn10=new Button("9");
btn11=new Button("+");
btn12=new Button("-");
btn13=new Button("*");
btn14=new Button("/");
btn15=new Button("=");
btn16=new Button("清空");
//将文本的初始值设置成0
numText=new TextField("jiangxiaoming");
//实例化放按钮的Panel;
btnPanel=new Panel();
//将布局模式设置成流式布局
btnPanel.setLayout(new FlowLayout());
//为每个按钮添加事件
btn1.addActionListener(new btnAction());
btn2.addActionListener(new btnAction());
btn3.addActionListener(new btnAction());