Inner Class TextFieldHandler
The event handling in this example is performed by an object of the private inner class TextFieldHandler (lines 50–81). This class is private because it will be used only to create event handlers for the text fields in top-level class TextFieldFrame. As with other class members, inner classes can be declared public, protected or private. Since event handlers tend to be specific to the application in which they’re defined, they’re often implemented as private inner classes or as anonymous inner classes (Section 12.11).
GUI components can generate many events in response to user interactions. Each event is represented by a class and can be processed only by the appropriate type of event handler. Normally, a component’s ...
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