Re: Event Handling Question
>Something about the AWT event model is puzzling me. Scenario: A button
>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?
>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!
>(note: also posted in AWT message board)
*Awt sends action event to button which is clicked
*for processing this event button has to be registered
*new Button().addButtonListener(this) will register button for this object
& passes its reference to awt
*functions like processActionEvent(java.awt.ActionEvent )
1)processes this event & dispatches to registered listener
2)invoked only when ActionListener object is registered or
ActionEvents are enabled by enableEvents
*Button object calls all methods in interface class 1 at a time
& thus do processing for all methods
*whatever methods u dont require u can give their body as blank
if u implement interface or either extend from adapter classes
& override only those methods u require & leave other to super class