Component::addMouseListener question


Hi everyone!

Please, a quick answer to a quick question :wink:

If I apply a mouse listener to a parent Component:

And then, a childComponent broadcasts a mouse event towards their parent, How does I know what child fires such event?
(because the parentComponent owns several childComponents)

Thank you,



Ok, quick answer :

Component *const originalComponent is a public attribute of the mouse event and I think it should do the trick

See :


OK Dinaiz,

But the callback is hosted in the parentComponent, the only parameter passed to the parent through the callback is:

(among other events.)

I know that MouseEvent class has two members: eventComponent and originalComponent. I’ve done some checks and it worked.
So what is the convenient one for this purpose?



No idea, in that case, I guess they are the same …