aspose file tools*
The moose likes Java in General and the fly likes Mouse problem : How to filter mouse actions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Mouse problem : How to filter mouse actions" Watch "Mouse problem : How to filter mouse actions" New topic
Author

Mouse problem : How to filter mouse actions

zoe goddard
Ranch Hand

Joined: Dec 12, 2000
Posts: 74
I've got a main window that has a canvas3d in it and it rotates with the mouse. I've popped up a second window with a different canvas3d window. These windows have different views of the same universe. I hooked up the mouse to rotate the view of the main window and not to the popup window. This portion appears to be working ok. The problem is that when I do the mouse movements in the popup window it moves the items in the main window. How do I stop this? any help will be greatly appreciated.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
It sounds like you've got the main window listening to mouse motion events in the child window. Just don't do that.
With some example code (in the simplest form necessary to replicate your experience - no 3d graphics), someone might be able to point out a specific solution.
Good Luck.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
zoe goddard
Ranch Hand

Joined: Dec 12, 2000
Posts: 74
That's my exactly my question. How do you control which window the mouse listens to, or filter out the messages from the unwanted windows. Is this even possible in Java?
--- Got a solution ---
The MouseEvent contains the component that generated the message. I can filter on that.
[ May 17, 2002: Message edited by: zoe goddard ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
You may wish to peruse Sun's Java Tutorial Lessons on Writing Event Listeners and Event Handling.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Mouse problem : How to filter mouse actions