Home Java Beginners Java Applet

 
 

Share on Google+Share on Google+

Java Applet

Advertisement
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.

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:

  • They can run on any operating system
  • They are made in such a way that can work along with all Java Plug-in versions
  • Applets runs in a sandbox that means it can work without security approval
  • Most of the web browsers today like Mozilla, Chrome, Safari, Internet Explorer, etc support Applet.
  • Web browsers cache applets which makes it easy to load them.

Disadvantages of Java Applet:

  • Web browsers and operating system require Java plug-in to run applet
  • Java applet takes time to startup for the first time as it requires JVM.
  • If applet is not already cached in the machine, it will be downloaded from internet and will take time
  • Its hard design and build user interface in applets

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.

Resource:

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 31, 2013

Related Tutorials

Discuss: Java Applet  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com