Keep mouse pointer within frame/window
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 mous开发者_开发问答e from the window.
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)
精彩评论