AZERTY keyboard

Java: Missing key codes on non-US keyboards

Java does not seem to have key codes for several keys on non-US keyboards. This does not prevent the typed characters from being recognized, but it makes it impossible for the Robot class to simulate pressing these keys.

Examples of missing key codes

On a standard French AZERTY keyboard, 2 keys result in a key code of 0 (unknown key code): The key above the tab which generates the character “²” and the much more important ù% key.

On a German QWERTY keyboard, the ß?\ key and the äÄ,öÖ and üÜ keys are undefined.

You can confirm this using the Java KeyEventDemo:
Percentage key on AZERTY keyboard

Workaround

Use the Alt Numpad input method.

 

Leave a Reply