private static void simulateMove(Robot r, int x2, int y2) throws InterruptedException {
        int x1 = MouseInfo.getPointerInfo().getLocation().x, y1 = MouseInfo.getPointerInfo().getLocation().y;
        long starttime = System.currentTimeMillis();

        while (Math.abs(x1 - x2) > 5 || Math.abs(y1 - y2) > 5) {
            if (System.currentTimeMillis() - starttime > 11000) { //11 second timeout
                System.out.println("Timeout on Mouse-Click.");
                break;
            }

            if (x1 > x2)
                x1 -= (int)(Math.random() * 5);
            else
                x1 += (int)(Math.random() * 5);

            if (y1 > y2)
                y1 -= (int)(Math.random() * 5);
            else
                y1 += (int)(Math.random() * 5);

            r.mouseMove(x1, y1);
            Thread.sleep(10);
            x1 = MouseInfo.getPointerInfo().getLocation().x;
            y1 = MouseInfo.getPointerInfo().getLocation().y;
        }

        r.mouseMove(x2, y2);
    }