June 2017
Beginner
1296 pages
69h 23m
English
Let’s illustrate how the event-handling mechanism works, using textField1 from the example of Fig. 26.9. We have two remaining open questions from Section 26.7:
How did the event handler get registered?
How does the GUI component know to call actionPerformed rather than some other event-handling method?
The first question is answered by the event registration performed in lines 43–46 of Fig. 26.9. Figure 26.13 diagrams JTextField variable textField1, TextFieldHandler variable handler and the objects to which they refer.
JTextField textField1.
Read now
Unlock full access