I'm making a little game in java swing, it's a game where the enemy follows the cursor. But if the cursor exists the frame the application returns an error, so instead of that I made the application quit when the cursor leaves the window. But is there actually a way to directly set the cursor position?