Technical Support
Discussion Forum
Online Training
Read About Java
Java In-Depth
Product Discounts
Membership Information

Java Cup Logo

JDC Home Page


Working Applet
Help and Hints
Source Code
Table of Contents
Online Training
shadowSearchFAQFeedback

Solution

Download ButtonTest source code.

HTML Interface to Applet


<APPLET CODEBASE="/applets/magelang/AWT-Training/classes/" CODE="ButtonTest.class" WIDTH=70 HEIGHT=40 ALIGN=CENTER></APPLET>

Java Code


import java.awt.*;

public class ButtonTest extends java.applet.Applet {
    public void init() {
        Button b = new Button("HIT ME");
        add(b);
    }
    public boolean action(Event e, Object label) {
        System.out.println("Pressed " + label);
        return true;
    }
}