/** * Holds a key down for the given time * * @param keycode The keycode, such as KeyEvent.VK_X * @param millis The time to hold the key down for in milliseconds */ public void hold(int keycode, int millis) { handler.pressKey(keycode); Utils.sleep(millis); handler.releaseKey(keycode); }
/** * Simulates a key press * * <p>Note: The key is not automatically released, so this must be matched with a <code> * release(keycode)</code> * * @param keycode */ public void press(int keycode) { handler.pressKey(keycode); }