Previous | Next | Trail Map | Creating a User Interface (with Swing) | Using the JFC/Swing Packages

How to Write a Change listener


Note: This section assumes that you're familiar with the AWT event listener scheme. If you aren't, you can read about it in The 1.1 AWT Event Model(in the Creating a User Interface trail).
Change events occur when [PENDING].

Change Event Methods

The ChangeListener interface has just one method, so it has no corresponding adapter class. Here's the method:
void stateChanged(ChangeEvent)
Called when [PENDING].

Examples of Handling Change Events

[PENDING]

The ChangeEvent Class

The stateChanged method has a single parameter: a ChangeEvent(in the API reference documentation) object. To get the [PENDING object] that generated the event, use the getSource method which ChangeEvent inherits from EventObject.

The ChangeEvent class defines [PENDING] handy methods ...

[PENDING]
[PENDING]


Previous | Next | Trail Map | Creating a User Interface (with Swing) | Using the JFC/Swing Packages