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!
posted 13 years ago
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.