0

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);
}
App Work
  • 21,899
  • 5
  • 25
  • 38
El_Mundo
  • 17
  • 7

1 Answers1

1

'a' evaluates to 97 in UTF-8.

    KeyStroke.getKeyCode()  

simply returns an integer representation of 'a'.

workernode
  • 74
  • 9
  • http://stackoverflow.com/questions/397113/how-to-make-the-java-awt-robot-type-unicode-characters-is-it-possible – André Dec 04 '14 at 19:54