Advertisement
Guest User

Untitled

a guest
May 27th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import java.awt.AWTException;
  2. import java.awt.Dimension;
  3. import java.awt.Robot;
  4. import java.awt.Toolkit;
  5. import java.awt.event.InputEvent;
  6. import java.util.Random;
  7.  
  8. public class Mouse {
  9.  
  10. public static void main(String[] args) throws AWTException {
  11.  
  12. Robot r = new Robot();
  13. Random r1 = new Random();
  14. Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
  15. while (true) {
  16. int x = r1.nextInt((int)s.getWidth() + 1);
  17. int y = r1.nextInt((int)s.getHeight() + 1);
  18. r.mouseMove(x, y);
  19. r.mousePress(InputEvent.BUTTON1_MASK);
  20. r.mouseRelease(InputEvent.BUTTON1_MASK);
  21. }
  22.  
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement