import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class BasicInOut extends Applet
implements ActionListener{
Label prompt;
TextField input1;
TextField input2;
public void init(){
prompt = new Label("Enter two numbers: ");
input1 = new TextField(3);
input2 = new TextField(3);
add(prompt);add(input1); add(input2);
input1.addActionListener(this);
input2.addActionListener(this);
}
public void paint(Graphics g) {
int a,b,c;
a=Integer.parseInt(input1.getText());
b=Integer.parseInt(input2.getText());
c=a+b;
g.drawString("The sum is "+c,60,80);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==input2)
repaint();
}
}
编译已经通过了啊 ,以前我的网页也能打开,可现在不知道为什么不行了