February 2014
Beginner
1248 pages
62h 25m
English
In this example, we use one event-handling object’s actionPerformed method (lines 53–80) to handle the events generated by four text fields. Since we’d like to output the name of each text field’s instance variable for demonstration purposes, we must determine which text field generated the event each time actionPerformed is called. The event source is the component with which the user interacted. When the user presses Enter while a text field or the password field has the focus, the system creates a unique ActionEvent object that contains information about the event that just occurred, such as the event source and the text in the text field. The system passes this ActionEvent object ...
Read now
Unlock full access