Java robot.mouseMove(x, y) not producing correct results

The JDK Bug website says a current workaround is to call the function in a loop until the mouse moved to the right space. You could use a function like this:

public static void moveMouse(int x, int y, int maxTimes, Robot screenWin) {
    for(int count = 0;(MouseInfo.getPointerInfo().getLocation().getX() != x || 
            MouseInfo.getPointerInfo().getLocation().getY() != y) &&
            count < maxTimes; count++) {
        screenWin.mouseMove(x, y);
    }
}

Max times is there to stop an infinite loop in case something happens. Usually 4-5 times is good enough for me.