Applet Code template - Java Applet

Java examples for Applet:Applet Creation

Description

Applet Code template

Demo Code

import java.applet.Applet;
import java.awt.Graphics;

public class BasicApplet extends Applet {
    // This method is called once by the browser when it starts the applet.
    public void init() {
    }/*  ww w .j a  va  2  s.  com*/

    // This method is called whenever the page containing this applet is made visible.
    public void start() {
    }

    // This method is called whenever the page containing this applet is not visible.
    public void stop() {
    }

    // This method is called once when the browser destroys this applet.
    public void destroy() {
    }

    // This method is called whenever this applet needs to repaint itself.
    public void paint(Graphics g) {
    }
}

applet tag

<applet code=BasicApplet width=100 height=100>
</applet>

Related Tutorials