Using Delegation Event Handling
Java 2 uses the Delegation event-handling mechanism introduced in JDK 1.1. This mechanism uses three main participants in user interactions with a Java GUI:
Event sources—Components such as Button, JList, and JMenuItem, as well as Containers.
Events—Defined by classes in java.awt.event. The class names have the form xxxEvent, where xxx represents an event type, such as Action or Item. The main event types you will normally deal with are ActionEvents, ItemEvents, FocusEvents, MouseEvents, and WindowEvents. Other useful event classes include TextEvent and MouseMotionEvent.
Event Listeners—Defined in java.awt.event. Class names have the form xxxListener, where xxx is an event type, such as ActionListener, TextListener, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access