I have problem with pressing a special letter (Chinese, cyrillic etc.) via java robot class. I hava a method to press keys which works as alt+keycode. I cant convert some special letters to corrent keycode. So how can I solve it. Thanx
For Example:
KeyStroke ks = KeyStroke.getKeyStroke('a', 0);
System.out.println(ks.getKeyCode());
Output : 97
//but if I convert 'ş' to keycode
//Output is 351 . So alt+351= '_' The Correct combination is alt+0254 for 'ş'
KeyPress:
public static void doType(int a, int keyCodes)
throws AWTException {
Robot robot = new Robot();
robot.keyPress(VK_ALT);
robot.keyPress(keyCodes);
robot.keyRelease(keyCodes);
robot.keyRelease(VK_ALT);
}
'a' evaluates to 97 in UTF-8.
KeyStroke.getKeyCode()
simply returns an integer representation of 'a'.