An applet is a compiled program that is meant to run inside a web
browser. It is perfect for quickly distributing applications with
the internet. The applet is compiled to bytecode and an interpreter
that is added on to the browser executes the byte code.
- Ease of distribution
Many uses of applets have been found, such as:
The core part of an applet is below as created by blueJ:
* Class TestApplet - write a description of the class here
* @author (your name)
* @version (a version number)
public class TestApplet extends JApplet
* Paint method for applet.
* @param g the Graphics object for this applet
public void paint(Graphics g)
// simple text displayed on applet
g.fillRect(0, 0, 200, 100);
g.drawString("Sample Applet", 20, 20);
g.drawString("created by BlueJ", 20, 40);
The paint method is called when the applet is run.
There are many methods that are included with the graphics class
- see here.
this activity .