the figure below:
Initial State: When a new applet is born or created, it is activated by calling init() method. At this stage, new objects to the applet are created, initial values are set, images are loaded and the colors of the images are set. An applet is initialized only once in its lifetime.
It's general form is:
public void init( )
//Action to be performed
}
Running State: An applet achieves the running state when the system calls the start() method. This occurs as soon as the applet is initialized. An applet may also start when it is in idle state. At that
time, the start() method is overridden.
It's general form is:
public void start( )
{
//Action to be performed
}
Idle State: An applet comes in idle state when its execution has been stopped either implicitly or explicitly. An applet is implicitly stopped when we leave the page containing the currently running applet. An applet is explicitly stopped when we call stop() method to stop its execution.
It's general form is:
public void stop()
{
//Action to be performed
}
Dead State: An applet is in dead state when it has been removed from the memory. This can be done by using destroy() method.
It's general form is:
public void destroy( )
{
//Action to be performed
}
Display State (paint ()): Apart from the above stages, Java applet also possess paint( )method. The paint() method is used for applet display on the screen. This method helps in drawing, writing and
creating colored backgrounds of the applet. It takes an argument of the graphics class. To use The graphics, it imports the package java.awt.Graphics.
0 Comments