PDA

View Full Version : سوال: مشکل در Applet در جاوا



dolati1703
پنج شنبه 30 مهر 1388, 16:36 عصر
سلام من تو کد زیر مشکل دارام اگه کسی بلدخ کمک کنه مهمه
جایی رو که قرمز کردم ارور داره:





import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class test1 extends Applet
{
Label enter =new Label("Enter Number 1");
Label result =new Label("Sum Is:");
TextField text=new TextField(5);
TextField output=new TextField(5);
Button calc=new Button("Calculate");
Font font =new Font("Helvetica",Font.BOLD,18);
int num,sum=0;
String s;
@Override
public void init()
{
enter.setFont(font);
result.setFont(font);
calc.addActionListener(this);
text.addActionListener(this);
add(enter);
add(text);
add(result);
add(output);
add(calc);

}
public void start()
{
text.setText("0");
}
public void actionPerformed(ActionEvent e)
{
num=Integer.parseInt(text.getText());
sum +=num;
s=String.valueOf(sum);
output.setText("0");
text.setText("0");
if(num<0)
calc.setEnabled(false);

}

}