Specifications

Sun Services
Java™ Programming Language
Module 11, slide 21 of 22
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Event Handling Using Anonymous Classes
1 import java.awt.*;
2 import java.awt.event.*;
3
4 public class TestAnonymous {
5 private Frame f;
6 private TextField tf;
7
8 public TestAnonymous() {
9 f = new Frame("Anonymous classes example");
10 tf = new TextField(30);
11 }
12
13 public static void main(String args[]) {
14 TestAnonymous obj = new TestAnonymous();
15 obj.launchFrame();
16 }
17