Java GUI Event Handling

When users interact with a GUI application, they perform actions that include but are not limited to moving the mouse around the window, clicking buttons, moving sliders, selecting checkboxes, and entering text into fields. All of these actions must be handled by the application.

To simplify the process of handling these actions, the AWT provides an event-handling mechanism, which has the component generating the event register an event handler for that specific event. These components effectively delegate the responsibility for handling these events to other classes, which is why this approach is referred to as the delegation model.

Using the delegation model, the client handlers are registered with the GUI component ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software 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.