This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mouse problem : How to filter mouse actions

 
zoe goddard
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
zoe goddard
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may wish to peruse Sun's Java Tutorial Lessons on Writing Event Listeners and Event Handling.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic