views:

92

answers:

0

The AWT Robot lets you send key press and release events given the keycode of the key you want to press. But the combination of key(s) you need to use to type a character depends on the input locale (e.g. the keyboard layout).

We've worked around that by writing our own Keyboard abstraction that maps characters to AWTKeyStrokes and loads the mappings from a configuration file named after the input locale. However, it's awkward to maintain and fails as soon as the tests are run on a machine with a keyboard layout we've not yet implemented.

It seems a big oversight that the Robot cannot be used to enter basic non-alphanumeric characters.

Is there a cross-platform API that converts characters to key strokes?