'Determine key combination based on current keyboard layout

Assume, I know my current keyboard's locale setting (there seems to be InputContext.getInstance().getLocale() for that), is there a way to determine programmatically which keys on the keyboard would need to be pressed to type a specific character?

Example:

  • Keyboard layout: German, Mac
  • Input: õ
  • Result: [alt-down, n-down, n-up, alt-up, o-down, o-up]

Background: I'm wondering if it's possible to make usage of the java.awt.Robot class more portable.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source