Delegation Event Model
- The main idea behind the "delegation" event model is that event handling is delegated to different objects and methods rather than having your GUI handle all the events.
- The idea is that events are processed by event listeners, which are separate objects that handle specific types of events.
- Note: In order to use the delegation event model properly, the GUI should not be the listener.
- The listener registers and specifies which events are of interest (for instance mouse events).
- Only those events that are being listened for will be processed.
- Each different event type uses a separate Event class.
- Each different kind of listener also uses a separate class.
- This model also allows your GUI to be organized such that the application code (Controller) and the interface code (the View) can be separated.
- Download the examples in downloads/swing/events
- These examples show Event Handling in Applets rather than GUI applications, but the Event-handling code is the same.