Applets are Java programs that run on java enabled web browser. Java applets can run on client servers with some restrictions. Applets are embedded into HTML pages to make a website more dynamic.
One of the restriction is that Applet cannot access system resources on local computer.
Advantages of Applet:
There are various advantages of using Java Applets:
Disadvantages of Java Applet:
Lifecycle of an Applet:
Applet runs in a web browser and its lifecycle method are called by JVM when it is loaded and destroyed. The Lifecycle of applet starts when it is first loaded in a web browser.
init() method initializes an applet. It can be called only once. The init() method reads the PARAM tag retrieves the passed parameter using get Parameter() method. All the initialization of variables and the objects are loaded in the init() method.
start() method is called after the initialization of the applet. It can be called multiple times. start() method is called after the init() method.
stop() method is called when user leaves one applet to go another applet. It can be called multiple times and should be called at least one time.
destroy() method is called when applet is destroyed. It can only be called once. destroy() method is called when the browser needs to Shut down.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Java Applet
Post your Comment