Use Robot to do mouse press : Robot « Development Class « Java






Use Robot to do mouse press

   

import java.awt.Robot;
import java.awt.event.InputEvent;

public class Main {
  public static void main(String[] args) throws Exception {
    Robot r = new Robot();
    r.mouseMove(35, 35);
    r.mousePress(InputEvent.BUTTON1_MASK);
    r.mouseRelease(InputEvent.BUTTON1_MASK);
    Thread.sleep(50);
    r.mousePress(InputEvent.BUTTON1_MASK);
    r.mouseRelease(InputEvent.BUTTON1_MASK);
  }
}

   
    
    
  








Related examples in the same category

1.Moving the Cursor on the Screen
2.Simulate a key press
3.Simulate a mouse click
4.Create mouse event using Robot class
5.Capture a screenshot
6.Get the colour of a screen pixel
7.Capturing a Screen Shot
8.Capturing Screen in an image using Robot class
9.Create key press event using Robot class?
10.Using Robot to capture a screen shapshot
11.Use Robot to send combo key event