Learn how event sources are used to facilitate event communication.
Event Sources Communication
An event source is a component capable of generating events.
Event source must provide a means of registering listeners, which is how the sources know where to send event notifications. When an event occurs within an event source, the source is responsible for examining the registered listeners and sending event notifications appropriately.
Java Components that support 1) low-level and 2) semantic event listener interfaces
Similar to event listeners, event sources can be distinguished by whether they generate low-level or semantic events. Following are the standard Java components that generate low-level events, and therefore support low-level event listener interfaces:
Component
Dialog
Frame
Following are the standard Java components that support semantic event listener interfaces:
Button
Choice
Checkbox
CheckboxMenuItem
List
MenuItem
Scrollbar
TextField
Definition: Event source: a component capable of generating events.
JavaBeans Event Model
Based the Java 1.1 event model
An object interested in receiving events is an event listener â sometimes called event receiver
An object that generates (fire) events is called an event source â sometimes called event sender
Event listeners register their interest of receiving events to the event source
Event source provides the methods for event listeners to call for registration
The event source maintains a list of listeners and invoke them when an event occurs
In the next lesson, you learn how to handle events by registering event listeners.