Explain Applet.
- Applets are small programs that are designed to execute in web browsers to generate dynamic content. They require a Java plugin to run on the client browser. Applets work at the client-side with minimum response time. They can be executed by browsers on multiple platforms such as Windows, Linux, and Mac. In an applet, the code is embedded in an HTML page. When there is a java-enabled web browser, the applet code transfers to the system, and code is executed on the browser.
- Applets can be used to perform various tasks. They can be used to display graphics, create animations, play sound, etc. It is possible to add an applet to a web page locally or remotely. A local applet is developed and stored in the local system. A remote applet is developed and stored externally.
- An applet is a Java program that can be embedded into a web page. It runs inside the web browser and works on the client-side. An applet is embedded in an HTML page using the APPLET or OBJECT tag and hosted on a web server.
- Applets are used to make the website more dynamic and entertaining.
- Applets are small programs that utilize an external API for its execution and are primarily used in internet computing. They can be transferred over the Internet from one computer to another and run using the Applet Viewer or any web browser that supports Java. An applet can support several applications such as executing arithmetic operations, the creation of animation, graphics displaying, playing interactive games.
Java has transformed the manner in the Internet users retrieve and use documents on the world wide network. Applets have enabled to construction and use of completely interactive multimedia Web documents. A web page can include a java applet which, when executed, can generate graphics, sounds, and moving images rather than just containing plain text or a static image.
Important points :
1. All applets are sub-classes (either directly or indirectly) of java.applet.Applet class.
2. Applets are not stand-alone programs. Instead, they run within either a web browser or an applet viewer. JDK provides a standard applet viewer tool called applet viewer.
3. In general, execution of an applet does not begin at main() method.
4. Output of an applet window is not performed by System.out.println(). Rather it is handled with various AWT methods, such as drawString().
There are two ways an applet can integrate into web pages.
- First in which we can write our own applets and integrate them into web pages. These types of applets evolved locally and kept in a local system is known as a local applet.
- Second, we can download an applet from a remote computer system and then embed it into a web page.
These types of applets which are developed externally and stored on a remote computer to the Internet are known as a remote applet.
OR,
Unlike a Java application program, an applet is specifically designed to be executed within an HTML web document using an external API. They are basically small programs – more like the web version of an application – that require a Java plugin to run on client browser. They run on the client side and are generally used for internet computing. You can execute a Java applet in a HTML page exactly as you would include an image in a web page. When you see a HTML page with an applet in a Java-enabled web browser, the applet code gets transferred to the system and is finally run by the Java-enabled virtual machine on the browser.
Applets are also compiled using the javac command but can only run using the appletviewer command or with a browser. A Java applet is capable of performing all kinds of operations such as play sounds, display graphics, perform arithmetic operations, create animated graphics, etc. You can integrate an applet into a web page either locally or remotely. You can either create your own applets locally or develop them externally. When stored on a local system, it’s called a local applet. The ones which are stored on a remote location and are developed externally are called remote applets.
Browsers come with Java Runtime environment (JRE) to execute applets and these browsers are called Java-enabled browsers. The web page contains tags which specify the name of the applet and its URL (Uniform Resource Locator) – the unique location where the applet bytecodes reside on the World Wide Web. In simple terms, URLs refer to the files on some machine or network. Unlike applications, Java applets are executed in a more restricted environment with harsh security restrictions. They cannot access the resources on the system except the browser-specific services.
Comments
Post a Comment