Program for Demonistrating LIFE CYCLE OF APPLET
import java.awt.*; import java.applet.Applet; import java.awt.event.*; import java.applet.*; public class App extends Applet imple...
https://www.computersprofessor.com/2016/06/life-cycle-of-applet.html
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import java.applet.*;
public class App extends Applet implements ActionListener
{
TextField
text1,text2,ans;
Label plus;
Button bt;
public void init()
{
text1=new
TextField();
text2=new
TextField();
ans=new
TextField();
plus=new
Label("+");
bt=new
Button("=");
bt.addActionListener(this);
add(text1);
add(plus);
add(text2);
add(bt);
add(ans);
}
public void
actionPerformed(ActionEvent e)
{
if(e.getSource()==bt)
{
int
sum=Integer.parseInt(text1.getText())+Integer.parseInt(text2.getText());
ans.setText(String.valueOf(sum));
}
}
}
APPLET.HTML
<html>
<head>
<title> APPLET</title>
</head>
<body bgcolor="yellow">
<applet code="App" width="200" height="300"/>
</body>
</html>
OUTPUT: