[solved] Setting the Hardware Mouse Position

(See my last post here for my solution)

I'm attempting to make the illusion of the mouse staying where it started when it was grabbed (using the hardware mouse) by storing the X,Y values and resetting after release.  This seems to me like it should work, however it just  doesn't reset the position…it actually doesn't set the position at all, even if I use the MouseInput.get().setCursorPosition method.  Am I missing some update call or something?  I know the x and y values are received correctly, it just doesn't set properly.

public void onMousePress(boolean pressed)
      origX = Mouse.getX();
      origY = Mouse.getY();
      Mouse.setCursorPosition(origX, origY);

Hmm, is this even possible…  I can't think of a good example of Java changing the cursor's position in general.

Well…I guess I could use java.awt.Robot.mouseMove(x,y), but I haven't tried it.  I can try it later today when I get back.

Good point, though…heh.

Update on this:

I used:  myRobot.mouseMove(origX, displayHeight-origY);

to have this functionality.  It works from what I've seen, but according to the Robot documentation, it may not work depending on the system configuration and permissions.  I'm sure you know why, but for some who don't, I subtract the original Y from the displayHeight because the Java y-coordinate starts from top=0, as opposed to bottom=0.

So, that'll solve my problem, now I need to figure out whether I really want to do this, from a user-standpoint!