How to respond to mouse events AND pass to parent Component?


#1

I’m trying to have a Label component, which is positioned on top of another component, respond to mouse events and pass these to its parent component so that the parent can also handle them.

What’s the best way to achieve this?

I can use setInterceptsMouseClicks(false, true) on the child, but then only the parent gets the mouse events and not the child. Without this, only the child gets the events and not the parent.

Thanks,

Jamie


#2

You can use addMouseListener to spy on events to other components