Applet is a special type of program that is embedded in the webpage to generate the dynamic content. It runs inside the browser and works at client side.
Plugin is required at client browser to execute applet.
There are many advantages of applet. They are as follows:
As displayed in the above diagram, Applet class extends Panel. Panel class extends Container which is the subclass of Component.
The java.applet.Applet class 4 life cycle methods and java.awt.Component class provides 1 life cycle methods for an applet.
For creating any applet java.applet.Applet class must be inherited. It provides 4 life cycle methods of applet.
public void paint(Graphics g): is used to paint the Applet. It provides Graphics class object that can be used for drawing oval, rectangle, arc etc.
There are two ways to run an applet