I have been using Processing with java.awt.Robot and java.awt.Dimension to lock the mouse into the center of the screen. robot moves the mouse to relative to to the monitor, I need it to be relative to the window. I need a suggestion for how to get window location or a class like robot that works relative to the window.
void MouseLock() {
if(mouseX != screensizex/2 || mouseY != screensizey/2) {
xmovement = (mouseX - screensizex/2);
Ymovement = (mouseY - screensizey/2);
try {
Robot screenWin = new Robot();
screenWin.mouseMove((int)screensizex/2, (int)screensizey/2);
} catch (Exception e) {
e.printStackTrace();
}
}
}
anything that gets my xmovement and ymovement while disabling the mouse from leaving the program will work
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…