This tutorial will highlight the basics process to build applets and also it discusses the advantages and disadvantages of the applets including the life cycle of an applet.
A Java Applet is a small dynamic program which can be transferred via the Internet and run by a Java compatible web browser. It can be embedded into HTML pages, which runs on the java enables web browsers such as mozila and Internet explorer. Applet is designed to run remotely on the client browser, so there are some restrictions on it. Applet can't access system resources on the local computer. Applets are used to make the web site more dynamic and entertaining.
The main difference between Java based applications and applets is that these are typically executed in an Applet viewer or Java compatible web browser.
Life cycle of an Applet:
There are four methods in the Applet class, which provides you the framework on which one can build any significant applet. These are init, start, stop, destroy and paint.
What are the advantages of Applet?
- Applets are cross platform and can run on Windows, Mac OS and Linux platform.
- Automatically integrated with HTML, hence resolved virtually all installation issues.
- Applets can work all the version of Java Plugin
- Applets runs in a sandbox, so the user does not need to trust the code, so it can work without security approval.
- It can be accessed from various platforms and various java-enabled web browsers.
- Applets are cached in most web browsers, so will be quick to load when returning to a web page.
- User can also have full access to the machine if user allows.
Disadvantages of Java Applet:
- Applets can't with any host other than the originating server.
- Java plug-in is required to run applet
- Java applet requires JVM so first time it takes significant startup time
- If applet is not already cached in the machine, it will be downloaded from Internet and will take time.
- Applets can't read and write to local computer's file system.
For more about Java Applets topics visit the below links