An applet is an piece of software code that runs under the control of a web browser, as distinct from the application which requires an interpreter.


Applets are commonly used to enhance the interactivity of a web page, and deliver client-side content. Applets run in their own frame, and can display graphics, accept input from GUI components, and even open network connections. Applets running under a browser often demonstrate a certain degree of instability depending on the platform under which it is run. Applets are small applications that are accesses on Internet server, transported over the net, automatically installed. Once an Applet arrives on the client , it has limited access to resources so that it can produce an arbitrary multi-media user interface and run complex computations without introducing the risk of  viruses or breaching data integrity.


Common use of Java Applets


  One of the most common use Java applets is gamming like Addicting Games, Mini Clip and Pogo. For example, when we launch a chess game, it might be rendered as a Java applet. We will activate the applet by clicking within its borders, after which we can move the chess pieces around.

  Java applets is used  within communication applications, such as instant messaging applications and chat rooms. In the case of chat clients, Java Applets may operate outside the realm of the HTML Web browser and stand on its own. Even then, however, the Java Applet is backed by the environment of the operating system.

  Educational tools are developed by Java Applets such as  calculators (math), money management practice sheets (finance), composition and theory exercises (music), population growth demonstration charts (biology, social sciences), time management tools (life skills) and many more. Users can input data, move objects around, manipulate shapes or anything else the developer designs the Java applet to do.

  Java Applets can also used in the development of spreadsheets and word processors

  Java applets are small and light enough to operate in mobile browsers and applications. Due to their relatively small RAM, mobile phones and PDAs often run Java applets as stand-alone programs for use offline or online.

Hello word to Java Applet

Let us begin by compiling and running simple applet .

import java.awt.*;

import java.applet.*;

public class HelloWorldApplet extends Applet{

public void paint (Graphics g){

g.drwaString("HelloWorld!" ,20,20);



To run the applet in a web browser we need to write a few lines of HTML text. We can test our compiled applet by starting appletviewer with the Java source code file.

The following HTL runs HelloworldApplet:

<applet code="HelloWorldApplet" width=200 height=40>


In general there are 3 steps to quickly iterate through the development

  1. Edit Java soucre file
  2. Compile our program with javac
  3. Execute appletviewer to run applet.

The <applet> tag is used to start an applet from both HTML document and from the JDK appletviewer. The appletviewer will execute each applet tag that it finds in a separate window, while we browser will allow many applets on a single page

The syntax for <applet> tag

<applet codebase = codebaseURL code = appletFile alt=alternateTextname =appletInstanceName width=pixels height=pixels align=alignment Vspace =pixels Hspace=pixels>

<param name=AttributeName value=AtrributeValue>

 [Html displayed in the absence of Java]


Sandeep Joshi
Mathematics, Technology and Programming are my passion. I am a part of Java Ecosystem and through this blog, I contribute to it. I am here to blog about my interests, views and experiences.
I am on Google+ and Facebook.
I feel proud to be listed as a "National Memory Record Holder" in the Limca Book of Records, 2009 and have attempted for an International Memory record in the Guiness Book of Records. I can remember the value of PI upto 10,000 digits after the decimal (3.1415.....). You can contact me on ; I would like to hear from you :)