Home » Types of Applets in Java

Types of Applets in Java

by Online Tutorials Library

Types of Applets in Java

A special type of Java program that runs in a Web browser is referred to as Applet. It has less response time because it works on the client-side. It is much secured executed by the browser under any of the platforms such as Windows, Linux and Mac OS etc. There are two types of applets that a web page can contain.

  1. Local Applet
  2. Remote Applet

Types of Applets in Java

Let’s understand both types of Applet one by one:

Local Applet

Local Applet is written on our own, and then we will embed it into web pages. Local Applet is developed locally and stored in the local system. A web page doesn’t need the get the information from the internet when it finds the local Applet in the system. It is specified or defined by the file name or pathname. There are two attributes used in defining an applet, i.e., the codebase that specifies the path name and code that defined the name of the file that contains Applet’s code.

Specifying Local applet

Let’s take an example of Local applet to understand how we can create it and embedded it into web page.

  1. First, we will create a Local Applet for embedding in a web page.
  2. After that, we will add that Local Applet to the web page.

FaceApplet.java

Execute the above code by using the following commands:

Types of Applets in Java

Remote Applet

A remote applet is designed and developed by another developer. It is located or available on a remote computer that is connected to the internet. In order to run the applet stored in the remote computer, our system is connected to the internet then we can download run it. In order to locate and load a remote applet, we must know the applet’s address on the web that is referred to as Uniform Recourse Locator(URL).

Types of Applets in Java

Specifying Remote applet

Difference Between Local Applet and Remote Applet

The following table describes the key differences between Local applet and Remote applet.

Local Applet Remote Applet
There is no need to define the Applet’s URL in Local Applet. We need to define the Applet’s URL in Remote Applet.
Local Applet is available on our computer. Remote Applet is not available on our computer.
In order to use it or access it, we don’t need Internet Connection. In order to use it or access it on our computer, we need an Internet Connection.
It is written on our own and then embedded into the web pages. It was written by another developer.
We don’t need to download it. It is available on a remote computer, so we need to download it to our system.

You may also like