public static void typeCharacter ( final Robot robot , final char character ) throws IllegalAccessException , NoSuchFieldException { final boolean upperCase = Character . isUpperCase ( character ) ; final int keyCode = getKeyCode ( character ) ; if ( upperCase ) { robot . keyPress ( KeyEvent . VK_SHIFT ) ; } robot . keyPress ( keyCode ) ; robot . keyRelease ( keyCode ) ; if ( upperCase ) { robot . keyRelease ( KeyEvent . VK_SHIFT ) ; } }
Types the given char with the given robot .