Event Handling Question
Something about the AWT event model is puzzling me. Scenario: A button component
has registered an event listener (implementing a MouseAdapter, for instance).
Now, the Listener is implementing, say, two or three methods (mouseClicked,
mouseExit, etc.). When the mouse clicks on the button, or exits the button,
this "Event" is passed to the appropriate method implemented in the Listener
(then handled in some way).
All that is fine and dandy. But my questions...
What is actually generating the original event? I read things like, "The
AWT passes the event to the component(button)." If that is the case, and
the button isn't generating the event object, then what in the AWT is? Also,
once the event object exists, how does the button know which method in the
Listener to call? It's passing (or forwarding the event object) but how
does it know it should pass it to mouseClicked, or mouseExit, etc.?
Any help or explanation is greatly appreciated!