Simulate a key press in Java
Description
The following code shows how to simulate a key press.
Example
/*ww w .j av a2s . c om*/
import java.awt.Robot;
import java.awt.event.KeyEvent;
public class Main {
public static void main(String[] argv) throws Exception {
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
}
}