Aqua Phoenix
     >>  Lectures >>  Java 4  


4.2 Template

Applets are built by extending a basic Applet through Inheritance ( extends Applet ). That is, there exists an Applet class already in package java.applet by the name of Applet, for which one method needs to be rewritten in order to create a custom applet. This method could be considered similar to public static void main, i.e. the entry point into the application.

A template for any Java Applet follows:

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class APPLET_NAME extends Applet {

  public void init() {

where APPLET_NAME is the class name of the applet. Method init contains all code and/or method calls that will set-up the applet and prepare it to run.