What are Java Applets ?

What are Java Applets ?
What are Java Applets ?
  • Applets are
    – Small programs
    – Accessed on Internet Server
    – Transported over Internet
    – automatically installed
    – run as part of web document
  • Applet has limited access to resources, run complex computations
    without introducing the rist of virus or breaching data integrity.
  •  Applet class available in Applet package
    All applets are subclass of Applet class
  • import java.awt.*;
    import java.applet.*;

public class AppletDemo extends Applet
public void paint(Graphics g)
g.drawString (“Welcome to applets”,50,50);

  • applet interacts with AWT, not with I/O classes.
  • applet should be declared as PUBLIC as it is accessed by outside code.
  • paint() is called each time that the applet must redisplay its output.
  • Whenever we call redraw() , paint is called.
  • drawString(String msg,int x, int y)

1. execute applet with java compatible web browser (Netscape Navg.)
2. using appletviewer. (fastest and easiest way)


or C:\way2techworld> appletviewer AppletDemo.html

or C:\way2techworld> appletviewer AppletDemo.java (commented applet)

Leave a Reply