lundi 12 juin 2017

Trying to better Understand, being able to Drag mouse, rather than set Location

This is currently pieces out of a program that I have running. I am trying to switch from using set location to use drag mouse. I am using the set location between a math.random between a range. I would like to keep the range but just have my mouse be able to drag their rather than skipping to the point. I have read a few other program, but the concept is a bit confusing for me probably because I am overthinking it, but any hints, solutions, and/or tips would be great. Thanks!

Robot r = new Robot();

r.mouseMove (randX(), randY()); }

public static int randX() {

    Random rand = new Random();
    int maxX=888, minX=900;


    int randomX = (int) (Math.random() *((maxX - minX) + 1) + minX);

    return randomX;
}
public static int randY() {


    Random rand = new Random();
    int maxY=699, minY=712;


    int randomY = (int) (Math.random() *((maxY - minY) + 1) + minY);

    return randomY;
}

}




Aucun commentaire:

Enregistrer un commentaire