哪位大哥帮忙看一下我的程序为什么运行不了!!!!!!!!!!
//用APPLET实现简单计算器import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Computer extends Applet implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 0L;
int a = 0, b = 0, point, p = 0;
float c = 0;
String symbol = "", str = "";
TextField result;
Button bt1, bt2, bt3, bt4, bt5;
Button bt6, bt7, bt8, bt9, bt0;
Button bt_add, bt_plus, bt_multiply, bt_divide, bt_eqauls;
public void init() {
// TODO 自动生成方法存根
super.init();
result = new TextField(10);
result.setText("");
bt1 = new Button("1");
bt2 = new Button("2");
bt3 = new Button("3");
bt4 = new Button("4");
bt5 = new Button("5");
bt6 = new Button("6");
bt7 = new Button("7");
bt8 = new Button("8");
bt9 = new Button("9");
bt0 = new Button("0");
bt_add = new Button("+");
bt_plus = new Button("-");
bt_multiply = new Button("*");
bt_divide = new Button("/");
bt_eqauls = new Button("=");
add(result);
add(bt1);
add(bt2);
add(bt3);
add(bt4);
add(bt5);
add(bt6);
add(bt7);
add(bt8);
add(bt9);
add(bt0);
add(bt_add);
add(bt_plus);
add(bt_multiply);
add(bt_divide);
add(bt_eqauls);
result.addActionListener(this);
bt1.addActionListener(this);
bt2.addActionListener(this);
bt3.addActionListener(this);
bt4.addActionListener(this);
bt5.addActionListener(this);
bt6.addActionListener(this);
bt7.addActionListener(this);
bt8.addActionListener(this);
bt9.addActionListener(this);
bt0.addActionListener(this);
bt_add.addActionListener(this);
bt_divide.addActionListener(this);
bt_eqauls.addActionListener(this);
bt_multiply.addActionListener(this);
bt_plus.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
// TODO 自动生成方法存根
if(e.getSource()==bt1)
str=result.getText()+bt1.getLabel();
else if(e.getSource()==bt2)
str=result.getText()+bt2.getLabel();
else if(e.getSource()==bt3)
str=result.getText()+bt3.getLabel();
else if(e.getSource()==bt4)
str=result.getText()+bt4.getLabel();
else if(e.getSource()==bt5)
str=result.getText()+bt5.getLabel();
else if(e.getSource()==bt6)
str=result.getText()+bt6.getLabel();
else if(e.getSource()==bt7)
str=result.getText()+bt7.getLabel();
else if(e.getSource()==bt8)
str=result.getText()+bt8.getLabel();
else if(e.getSource()==bt9)
str=result.getText()+bt9.getLabel();
else if(e.getSource()==bt0)
str=result.getText()+bt0.getLabel();
result.setText(str);
if(p==0){
a=Integer.parseInt(result.getText());
p++;
result.setText("");
}
else{
b=Integer.parseInt(result.getText());
p++;
}
if(e.getSource()==bt_add){
symbol="+";
point=0;
result.setText("");
}
else if(e.getSource()==bt_plus){
symbol="-";
point=1;
result.setText("");
}
else if(e.getSource()==bt_multiply){
symbol="*";
point=2;
result.setText("");
}
else if(e.getSource()==bt_divide){
symbol="/";
point=3;
result.setText("");
}
if(p>1){
switch (point) {
case 0:
c=a+b;
result.setText(Float.toString(c));
break;
case 1:
c=a-b;
result.setText(Float.toString(c));
break;
case 2:
c=a*b;
result.setText(Float.toString(c));
break;
case 3:
c=(float)(a/b);
result.setText(Float.toString(c));
break;
}
}
}
}