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 ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.