Showing posts with label life cylce of an Applet. Show all posts
Showing posts with label life cylce of an Applet. Show all posts

Saturday, 5 March 2016

Life Cycle of a Java Applet

Java Applet Life Cycle

              The life cycle of a Java Applet has five main steps. 
  1.  Initialize the Applet
  2. Start the Applet
  3. Paint Applet
  4. Stop the Applet
  5. Destroy the Applet
Life Cycle of a Java Applet

1. Initialize the Applet


               In this step, the Applet is initialized. public void init() is the method used to initialize an Applet. It is only invoked once. 


2. Start the Applet


               In this step the Applet is start with the help of public void start() method. The start() method is invoked after calling the init() method. 


3. Paint Applet


               public void paint(Graphics g) method is used to paint the Applet. The method provides graphics class objects that can be used to draw shapes such as oval, rectangle, arc etc. 


4. Stop the Applet


               The applet is stopped with the help of public void stop() method. The method is invoked when the Applet is stopped of the browser is minimized.


5. Destroy the Applet


               This is the final step in the Applet life cycle. The Applet initialized is destroyed in this step. It is only invoked once and the method used to invoke is, public void destroy().