public class TestMath {
public static void main(String[] args) {
new TFFrame1().launchFrame();
}
}
class TFFrame1 extends Frame {
TextField num1,num2,num3;//必须定义成成员变量
public void launchFrame() {
num1 = new TextField(8);
num2 = new TextField(8);
num3 = new TextField(10);
Label l = new Label("+");
Button b = new Button("=");
b.addActionListener(new MyMonitor(tf)); 这里用变量tf咋不对啊?该用什么啊?
setLayout(new FlowLayout());
add(num1);add(l);add(num2);add(b);add(num3);
pack();
setVisible(true);
}
}