The Extended Simple Applet

Netscape 3.X:
Open the Java Console from the Options menu to see what is happening.

Netscape 4.X:
Open the Java Console from the Communicator menu to see what is happening.

Netscape 7
Open the Java Console from the Tools menu. Choose the Web Development submenu.

Internet Explorer 4
Open the Java Console from the View menu. If it is not there, go to View in the top menu and choose Internet Options. Choose the Advanced tab. Scroll down to Java VM. Make sure there is a check in the Java console enabled choice. Restart IE. You will now find the Java console in the View menu.


Source

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

public class ExtendedSimple extends Applet 
{

    public void init() 
    {
        System.out.println("initializing... ");
    } // init

    public void start() 
    {
        System.out.println("starting... ");
    } // start

    public void stop() 
    {
        System.out.println("stopping... ");
    } // stop

    public void destroy() 
    {
        System.out.println("destroying...");
    } // destroy


    public boolean mouseDown(Event evt, int x, int y)
    {
        System.out.println("mouseDown");
        return false;
    } // mouseDown

    public void paint(Graphics g) 
    {
        System.out.println("painting...");

        //Draw a colored Rectangle in the applet's display area.
	setForeground(new Color((int)(Math.random() * 256),
                           (int)(Math.random() * 256),
                           (int)(Math.random() * 256)));
        g.fillRect(0, 0, size().width - 1, size().height - 1);

    } // paint

    public void update(Graphics g)
    {
        System.out.println("updating...");
        super.update(g);
    } // update

    public void repaint()
    {
        System.out.println("repainting...");
        super.repaint();
    } // repaint

} // ExtendedSimple