Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unlimited mouse moves/drags



There are lots of situations where you want to use the mouse for something other than controlling the cursor on the screen. For example, 3D object viewers often use the mouse to rotate your viewpoint, or a game might use the mouse to steer a spaceship.
I'm trying to figure out how to implement this in Java. To a first approximation, it's simple. Call Toolkit.createCustomCursor() to create an invisible cursor. Set that as the cursor on your window. Now just listen for mouse moves and drags, and respond to them appropriately.
The problem is that you're still really just moving a cursor on the screen. You stop getting mouse move events as soon as the mouse leaves the window. Mouse drag events keep coming, but the cursor is still limited to the screen dimensions. So you're flying your spaceship, and suddenly hit a wall! No, it isn't a force field in space. :) The cursor has just run into the edge of the screen.
Obviously native applications manage to find a way around this problem. Does anyone know a way to do it from Java?


Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.