APPLET LIFE CYCLE:
- An applet pass through following states during life cycle as shown in following figure:
- The applet class defines following methods for managing the life-cycle of the applets.
init():
- This method is invoked when the first applet is loaded. It is called (only once) when the applet is first loaded to initialize the variable, resize the applet, setting up GUI component, and etc…
start():
- Invoked every time when browser display the web page containing the applet. The start() method automatically called after init() method.
stop():
- Invoked when the browser is closed, stops or suspend anything applet id doing. E.g. if the start method is start an animation, it should be stopped in the method.
destroy():
- Invoked when the browser determines that is no longer needs the applet this is when the applet is removed from the browser’s cache. Therefore the invocation of this method is controlled by the browser itself.
paint():
- Called immediately after start method, the paint method is what displays your applet on a webpage. Paint is also called any time the applet needs to repaint itself
Applet life sequence:
- User visit page containing an applet
- Browser calls init method on the applet, once and then
- Browser calls smart method on that applet
- Browser calls paint method in that applet
- User goes away form the page
- Browser calls stop on that applet
- User comes back to that page
- Browser calls start again on that applet
- Browser callls paint method on that applet
- User shuts down the browser
- Browser calls destroy on the appletProgram of applet life cycle
No comments:
Post a Comment
If any doubts, please let me know!!!