Most of the tutorials and documentation that I've been reading seem to indicate that most component communication takes place by subscription using listeners.
The Java docs indicate that java.awt.Component#dispatchEvent(AWTEvent e)
:
Dispatches an event to this component or one of its sub components. Calls processEvent before returning for 1.1-style events which have been enabled for the Component.
Given that listeners seem commonplace, what is the purpose of dispatchEvent
and how / where is the dispatched event received?
The component has to receive the events to dispatch somewhere. This is where a component receives the events. The events come from the EventQueue
.