package javaapplication76;
import java.awt.*;
import java.applet.*;
import javax.swing.*;
/**
*
* @author Ashik
*/
public class ApplerTesting extends Applet{
TextField textfield1,textfield2;
public void inti(){
textfield1=new TextField();
textfield2=new TextField();
add(textfield1);
add(textfield2);
textfield1.setText("0");
textfield2.setText("0");
}
public void paint(Graphics graphics){
int textfield1Numer, textfield2Numer,Answer;
String textfield1String,textfield2String,AnswerString;
graphics.drawString("please enter two number in the txtfield", 100, 200);
try{
textfield1String=textfield1.getText();
textfield1Numer=Integer.valueOf(textfield1String);
textfield2String=textfield2.getText();
textfield2Numer=Integer.valueOf(textfield2String);
Answer=textfield1Numer+textfield2Numer;
AnswerString=String.valueOf(Answer);
graphics.drawString("The summation is"+AnswerString, 100, 500);
}
catch(ArithmeticException arithmeticException){
JOptionPane.showMessageDialog(null,arithmeticExcep tion);
}
}
public Boolean action (Event event, Object object)
{
repaint();
return true;
}
}