II Event-Handling
II Event-Handling
• When an event occurs, the GUI component with which the user interacted
notifies its registered listeners by calling each listener's appropriate event-
handling method. For example, when the user presses the Enter key in a
JTextField, the registered listener's actionPerformed method is called. How did
the event handler get registered? How does the GUI component know to call
actionPerformed rather than another event-handling method? We answer these
questions and diagram the interaction in the next section
How event handling works
• Let us illustrate how the event-handling mechanism works, using
textField1 from the example. We have two remaining open questions
from :
textField1 handler