Child-component independent mouseEnter/mouseExit?


#1

For a hovering-mechanism, i need to know if the mouse is currently over a component, even if this mouse is currently over a containing component (with also has interaction, so hitTest is no option).

Does anybody has an idea how to quickly solve that? (without modification of the child components)


#2

bump


#3

You can do this with a MouseListener.. They can be set to listen to all events in all subcomponents of the one you attach it to.


#4

So i have to attach it on every sub component?


#5

No, just pass true as the second parameter to addMouseListener, that will automatically recieve events from all nested components. Then just check the mouse position relative to the parent to see if the mouse is still inside or not.


#6

No - see Component::addMouseListener


#7

thanks :) 

its just easier, mouseEnter/mouseExit will do the job