Пример #1
0
 public static void release(int x, int y, int button) {
   int buttonModifiers = getButtonModifiers(button);
   Component target = getTarget();
   Client.getMouse()
       .sendEvent(
           new MouseEvent(
               target,
               MouseEvent.MOUSE_RELEASED,
               System.currentTimeMillis(),
               buttonModifiers,
               x,
               y,
               1,
               false,
               button));
   isPressed = false;
   Client.getMouse()
       .sendEvent(
           new MouseEvent(
               target,
               MouseEvent.MOUSE_CLICKED,
               System.currentTimeMillis(),
               buttonModifiers,
               x,
               y,
               1,
               false,
               button));
 }
Пример #2
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[] {};
 }
Пример #3
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;
 }
Пример #4
0
 public static void enter(int x, int y) {
   Component target = getTarget();
   MouseEvent me =
       new MouseEvent(
           target,
           MouseEvent.MOUSE_ENTERED,
           System.currentTimeMillis(),
           0,
           x,
           y,
           0,
           false,
           MouseEvent.NOBUTTON);
   Client.getMouse().sendEvent(me);
 }
Пример #5
0
 public static void press(int x, int y, int button) {
   int buttonModifiers = getButtonModifiers(button);
   Component target = getTarget();
   Client.getMouse()
       .sendEvent(
           new MouseEvent(
               target,
               MouseEvent.MOUSE_PRESSED,
               System.currentTimeMillis(),
               buttonModifiers,
               x,
               y,
               1,
               false,
               button));
   isPressed = true;
 }
Пример #6
0
 public static Point getRealLocation() {
   MouseListener mouse = Client.getMouse();
   if (mouse != null) return new Point(mouse.getRealX(), mouse.getRealY());
   return new Point(-1, -1);
 }