Restrict mouse movement?

Didn’t know the best place to post this, hope this thread is ok.

Is there a way to restrict the movement of the mouse to a certain range? I am currently developing a game and have gotten the cursor to disappear when over the JPanel I am using, but I would like to make it that the cursor can’t get out of the JPanel unless the user pauses the game or something.

Thanks

I think java.awt.Robot from Java 1.3 on is the best you’re gonna get.

Thanks a lot man, this looks like it’s gonna do the trick.