Monday, May 7, 2007

Explain Lifecycle of the Applet. and what is the order of method invocation in an applet?

An applet is built up of four methods:init,start,stop and destroy.First of all an instance of applet subclass will be created and then applet will be initialized.Swing provides a special subclass of Applet, called javax.swing.JApplet, which should be used for all applets that use Swing components to construct their GUIs.
Here is a sequence of method calls in an applet :

-init():An applet can initialize itself and does whatever initializations are required to do for an applet.
-start(): This method is automatically called when applet is initialized.When a user comes back to a page with an applet this method is invoked then too.
-stop(): This method is called when user moves away from the webpage containing applet
-destroy:It is responsible for clean up and is called when browser is shut down normally.
An applet can be initialized and destroyed only once in its lifetime but it can be started and stopped several times.

0 comments :

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2017. Reads: best tracker