13.13. Handling Events in GUI Controls

In this section we present the general approach for handling events in GUI controls. Depending on the graphical control, different events are generated. For example, a Button generates ActionEvents and a Checkbox generates ItemEvents. As presented in Chapter 11 (Handling Mouse and Keyboard Events), you can use either high-level or low-level event processing to handle events. The two levels of event processing are briefly reviewed below.

  • High-level event processing. Process the event by attaching a listener to the component, using addXxxListener, where Xxx corresponds to the type of event the component can generate. Then, handle the event in the appropriate method defined by the listener. See Section 11.1 ...

Get Core Web Programming, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.