Ejemplo n.º 1
0
 public static void move(int x, int y) {
   Component target = getTarget();
   MouseEvent last = null;
   for (MouseEvent me : createPath(target, MousePathGenerator.generatePath(x, y))) {
     Client.getMouse().sendEvent(me);
     long lag = Math.max(0, mouseSpeed - 2 + new Random().nextInt(4));
     if (last != null) lag = me.getWhen() - last.getWhen();
     sleep(lag);
   }
   currentPath = new MouseEvent[] {};
 }
Ejemplo n.º 2
0
 public static void drag(int x, int y) {
   Component mouseTarget = Data.CLIENT_APPLET.getComponent(0);
   Component mouseMotionTarget = mouseTarget;
   MouseEvent[] me =
       createDragPath(
           mouseMotionTarget, mouseTarget, MousePathGenerator.generatePath(x, y), LEFT_BUTTON);
   isPressed = true;
   for (int i = 0; i < me.length; ++i) {
     Client.getMouse().sendEvent(me[i]);
     sleep(Math.max(0, mouseSpeed - 2 + new Random().nextInt(4)));
   }
   isPressed = false;
 }