O'Reilly logo

Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams by Jamie Jaworski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

An Event Delegation Example

Now that you have learned the event-handling classes and interfaces, it is time to work through a programming example so that you can see how they are used in a window application. Listing 13.1 presents the Event Sampler program. This program shows how the events of common AWT components are handled.

When you run EventApp, it displays the window shown in Figure 13.1. It provides samples of the following GUI components:

  • Text field— Typing Enter in the text field causes the contents of the text field to be converted to uppercase.

  • Text area— The text area is used to display the results of handling the events of the other GUI components.

  • Button— Clicking the button clears the contents of the text area.

  • Canvas— Clicking ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required