Methods used in Applet Program:
init() , start() , stop() , destroy() Available in Applet Class
paint() available in Component class and Component class is Super Class for Applet Class
Hierarchy:
Object
Component
Container
Panel
Applet
To execute applet program:
(A)Web Browser
(B)appletviewer
Code:
import java.applet.Applet;
import java.awt.Graphics; // Used to use Graphic class feature
public class FirstApplet extends Applet
{
public void paint( Graphics g )
{
g.drawString("Java" , 10 , 50);
}
}
/*
<applet code="FirstApplet" width=200 height=200>
</applet>
*/
Ouput:
init() , start() , stop() , destroy() Available in Applet Class
paint() available in Component class and Component class is Super Class for Applet Class
Hierarchy:
Object
Component
Container
Panel
Applet
To execute applet program:
(A)Web Browser
(B)appletviewer
Code:
import java.applet.Applet;
import java.awt.Graphics; // Used to use Graphic class feature
public class FirstApplet extends Applet
{
public void paint( Graphics g )
{
g.drawString("Java" , 10 , 50);
}
}
/*
<applet code="FirstApplet" width=200 height=200>
</applet>
*/