Here you can find the source of awtRobotKeyPress(final Robot robot, final int keyCode, final int msDelay)
private static void awtRobotKeyPress(final Robot robot, final int keyCode, final int msDelay)
//package com.java2s; import java.awt.Robot; public class Main { private static void awtRobotKeyPress(final Robot robot, final int keyCode, final int msDelay) { robot.keyPress(keyCode);/*from ww w . ja v a 2s . c om*/ robot.delay(msDelay); } /** No validation is performed .. */ public static int keyPress(final int i, final Robot robot, final boolean press, final int keyCode, final int msDelay) { final long t0 = System.currentTimeMillis(); if (press) { awtRobotKeyPress(robot, keyCode, msDelay); } else { awtRobotKeyRelease(robot, keyCode, msDelay); } return (int) (System.currentTimeMillis() - t0); } private static void awtRobotKeyRelease(final Robot robot, final int keyCode, final int msDelay) { robot.keyRelease(keyCode); robot.delay(msDelay); } }