Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.AWTException;
- import java.awt.Dimension;
- import java.awt.Robot;
- import java.awt.Toolkit;
- import java.awt.event.InputEvent;
- import java.util.Random;
- public class Mouse {
- public static void main(String[] args) throws AWTException {
- Robot r = new Robot();
- Random r1 = new Random();
- Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
- while (true) {
- int x = r1.nextInt((int)s.getWidth() + 1);
- int y = r1.nextInt((int)s.getHeight() + 1);
- r.mouseMove(x, y);
- r.mousePress(InputEvent.BUTTON1_MASK);
- r.mouseRelease(InputEvent.BUTTON1_MASK);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement