im tring to animate motion of the mouse from 1 button to another in an array with the class robot. here are the two methods I used:
public void optimusprime(int row, int column, JButton current) throws InterruptedException { Point p; Point p2; double x; double y; double x2; double y2; double conx = 0; double m; double b; double cony; p = current.getLocationOnScreen(); x = (int)( p.getX() + 30.5); y = (int)( p.getY() + 30.5); optimus((int) x, (int) y); p2 = mesa[row][column].getLocationOnScreen(); x2 = (int) (p2.getX() + 30.5); y2 = (int) (p2.getY() + 30.5); m = (y2 - y) / (x2 - x); b = y - (m * x); while (conx != x2) { conx = x; cony = (m * conx) + b; optimus((int) conx, (int) cony); conx++; Thread.sleep(500); } } public void optimus(int x, int y) { try { Robot robot = new Robot(); robot.mouseMove(x, y); } catch (AWTException e) { } } can any 1 help me here or at least give a recommendation?. got stock in an endless loop(had to shutdown the pc) and it didnt work at all; Im new to java it could be several stupid mistakes ;