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 TextFieldTest source code.

HTML Interface to Applet


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

Java Code


import java.awt.*;

public class TextFieldTest extends java.applet.Applet {
    public void init() {
        TextField text = new TextField(20);
        add(text);
    }
    public boolean action(Event e, Object text) {
        System.out.println("You typed '" + text + "'");
        return true;
    }
}