aspose file tools*
The moose likes Beginning Java and the fly likes Java Event Bubbling? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Event Bubbling?" Watch "Java Event Bubbling?" New topic
Author

Java Event Bubbling?

Tetsuo Suzuki
Greenhorn

Joined: Feb 21, 2002
Posts: 22
If I have an event handler for an object that sits inside a container with it's own event handler, does the event "bubble up" to the outer container? This is the behavior of objects within DHTML so I was just wondering if this was the case with Java.
Thanks -
Tetsuo!
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Generally, GUI events only get sent to the object that currently has the focus, in the case of Keyboard events, or a single component that was the target of a mouse event. If you have a JPanel with a button on it and you click the button, only the button will actually get notified of the button click. The JPanel will not.
This has caused me problems in the past as sometimes you want both to get the event, and yet there is no easy way to propogate events - you can rethrow them, but it's problematic because you have to do a lot of calulations yourself about what objects could be in the "target zone" at the time of the event.


Rob
SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Event Bubbling?