0% found this document useful (0 votes)
406 views

Event Handling

The Java event handling model uses the delegation event model where an event source generates and sends an event object to registered listener objects. This separates the application logic from the user interface logic. Events are generated from sources and handled by listeners following a standard mechanism defined in the java.awt.event package where sources register and unregister listeners to be notified of state changes represented by event objects.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
406 views

Event Handling

The Java event handling model uses the delegation event model where an event source generates and sends an event object to registered listener objects. This separates the application logic from the user interface logic. Events are generated from sources and handled by listeners following a standard mechanism defined in the java.awt.event package where sources register and unregister listeners to be notified of state changes represented by event objects.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Event Handling

Events are supported by the java.awt.event package. Handling events is based on the delegation event model. It defines standard and consistent mechanisms to generate and process events.
Concept: a source generates an event and sends it to one or more listeners. The advantage of this design is that the application logic separated from the user interface logic

Event Model

An event is an object that describes a state change A source is an object that generates an event A listener is an object that is notified when an event occurs. A source must register listeners General form:
public void addTypeListener(TypeListener el)

Multicasting, unicasting the event


public void removeTypeListener(TypeListener el)

Event, Source, Listener

Event Class Hierarchy

Event Listener Interfaces

You might also like