import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
public class KeyStroke {
public static void main(String[] args) throws AWTException {
Robot robot = new Robot();
robot.delay(3000);
robot.keyPress(KeyEvent.VK_Q);
// MIDDLE WHEEL CLICK
robot.mousePress(InputEvent.BUTTON3_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK);
// SCROLL THE MOUSE WHEEL
robot.mouseWheel(-100);
// RIGHT CLICK
robot.mousePress(InputEvent.BUTTON3_MASK);
robot.mouseRelease(InputEvent.BUTTON3_MASK);
// LEFT CLICK
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
// SET THE MOUSE X Y POSITIONq
robot.mouseMove(300, 550);
}
}
Thursday, 25 August 2016
How to make mouse and keyboard press using java program !!!!
Subscribe to:
Posts (Atom)