Advertisement
Guest User

Untitled

a guest
Apr 12th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1.     private Canvas canvas;
  2.     public Mouse(Client c) throws Exception {
  3.         this.client = c;
  4.         this.canvas = null;
  5.         for (Method m : Bot.class.getMethods()) {
  6.             if (Canvas.class.isAssignableFrom(m.getReturnType())) {
  7.                 canvas = (Canvas) m.invoke(this.client.getBot());
  8.             }
  9.         }
  10.         if (canvas == null) {
  11.             throw new Exception("Couldn't find canvas component!");
  12.         }
  13.     }
  14.    
  15.     private void setXY(int x, int y) {
  16.         MouseEvent me = new MouseEvent(this.canvas,
  17.                 MouseEvent.MOUSE_MOVED,
  18.                 System.currentTimeMillis(),
  19.                 MouseEvent.NOBUTTON,
  20.                 x, y,
  21.                 0,
  22.                 false);
  23.         this.dispatchEvent(me);
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement