Java examples for java.awt:Robot
Robot press Esc Key
//package com.java2s; import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; public class Main { public static void pressEscKey() { Robot robot = null;//from ww w. j ava 2 s.com try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } robot.keyPress(KeyEvent.VK_ESCAPE); robot.keyRelease(KeyEvent.VK_ESCAPE); } }