Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import java.awt.Robot;
  2. import java.awt.event.InputEvent;
  3.  
  4. public class ClickClass {
  5.  
  6. public static void main(String[] args) throws Exception {
  7.  
  8. Robot robot = new Robot();
  9.  
  10. int breite = 300; // ggf. anpassen (x koordinate)
  11. int hoehe = 500; // ggf. anpassen (y koordinate)
  12.  
  13. robot.mouseMove(breite, hoehe);
  14.  
  15.  
  16. // Links-Click
  17. int wieOft = 30; // klickt 30 mal
  18.  
  19. while(wieOft > 0) {
  20. robot.mousePress(InputEvent.BUTTON1_MASK);
  21. robot.mouseRelease(InputEvent.BUTTON1_MASK);
  22. try {
  23. Thread.sleep( 200 ); // klickt alle 200 ms
  24. System.out.println( "Zeit ist um." );
  25. } catch ( InterruptedException e ) { e.printStackTrace(); }
  26.  
  27. wieOft--;
  28. }
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement