Reputation: 11357
I want to prevent the mouse from being moved out of the window. I've seen it done before on Minecraft, where you have to press esc to release the mouse from the window.
Upvotes: 2
Views: 3569
Reputation: 5860
In Java you can use the Class Robot to position the mouse cursor anywhere on the screen. You could use this to move the mouse position back to the center after each mouse move event.
//Moves mouse pointer to given screen coordinates.
void mouseMove(int x, int y)
Upvotes: 6