Event delegation model has 3 components these are Event,Listener and Source..
In the delegation model, an event is an object that describes a state change in a source.
Event be generated as a consequence of a person interacting with the elements in a graphical user interface.
Some of the activities that cause events to be generated are pressing a button, entering a character via the keyboard, selecting an item in a list, and clicking the mouse.
Events may also occur that are not directly caused by interactions with a user interface like an event may be generated when a timer expires, a counter exceeds a value, a software or hardware failure occurs, or an operation is completed.
A source is an object that generates an event.
This occurs when the internal state of that object changes in some way. Sources may generate more than one type of event.
A source must register listeners in order for the listeners to receive notifications about a specific type of event.
Each type of event has its own registration method. public void addTypeListener(TypeListener el)
Type is the name of the event and el is a reference to the event listener.
The method that registers a keyboard event listener is called addKeyListener().
The method that registers a mouse motion listener is called addMouseMotionListener().
When an event occurs, all registered listeners are notified and receive a copy of the event object know as
multicasting the event
In all cases, notifications are sent only to listeners that register to receive them.
Some sources may allow only one listener to register.
public void addTypeListener(TypeListener el)
Type is the name of the event and el is a reference to the event listener. When such an event occurs, the registered listener is notified. This is known as unicasting the event.
A source must also provide a method that allows a listener to unregister an interest in a specific type of event. The general form of such a method is this:
public void removeTypeListener(TypeListener el)
A listener is an object that is notified when an event occurs.
Listener has two major requirements.
It must have been registered with one or more sources to receive notifications about specific types of events.
It must implement methods to receive and process these notifications.
The methods that receive and process events are defined in a set of interfaces found in java.awt.event.
For example, the MouseMotionListener interface defines two methods to receive notifications when the mouse is dragged or moved.
Any object may receive and process one or both of these events if it provides an implementation of this interface.