File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Mouse Event on Container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Mouse Event on Container" Watch "Mouse Event on Container" New topic

Mouse Event on Container

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
I have a Component placed inside a Container. When I click on the component, is it only the Component that will receive a mouse event - not the Container? If true, how can I tell the Container that it is clicked?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
if the component has any mouseListener added (tooltip etc) it will consume the event.
in that case you need to forward it to the container via dispatchEvent(...)
I agree. Here's the link:
subject: Mouse Event on Container
It's not a secret anymore!