File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes MouseListener and MouseMotionListener interrupting each other. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "MouseListener and MouseMotionListener interrupting each other." Watch "MouseListener and MouseMotionListener interrupting each other." New topic
Author

MouseListener and MouseMotionListener interrupting each other.

Caleb Kemper
Greenhorn

Joined: Feb 08, 2012
Posts: 27

In a simple game I'm coding, I need the MouseMotionListener to continue to call MouseMoved and accordingly adjust the rotation of the AffineTransform for my BufferedImage, even when the MouseListener is calling MouseClicked or MouseReleased. While it's calling these (say, I'm holding the mouse key down) it stops listening for motion. Is there a way around this? I tried adding another MouseMotionListener in the MouseClicked method. Still doesn't work. Also tried having it update the image when calling MouseDragged as well. Still nothing.
Any insight would be greatly appreciated.
Caleb Kemper
Greenhorn

Joined: Feb 08, 2012
Posts: 27

Don't know if anyone was keeping an eye on this for an answer, but I figured it out.
Basically, the Listeners were not interrupting each other (at least not significantly, to where the human eye could notice). It was just an issue with my MouseListener. I was using mouseClicked instead of mouseReleased for what I needed.
LiveLong&&Prosper
 
 
subject: MouseListener and MouseMotionListener interrupting each other.