6

Is there any way to achieve this?

I have a character, say "/" and I want to get the keyboard combination for this.

For the German layout, "/" would be Shift+7.

Genzotto
  • 1,816
  • 6
  • 24
  • 44
matthias
  • 1,712
  • 16
  • 39

1 Answers1

1

If I understand you correctly, you want to know what key combination is necessary to generate a specific character. The closest I have come to this is this bit of code: KeyboardLayout. It uses the keyboard layouts on Wikipedia to build a map of key codes for each language.

mikea
  • 6,399
  • 18
  • 35
  • do I understand correctly, you did save the combinations in a textfile and read them based on the keyboard locale? – matthias Jun 17 '14 at 09:41
  • No, the KeyboardLayout contains a map of Character to KeyStroke. It's not very elegant but it's the only way I've found to do it. – mikea Jun 17 '14 at 10:42
  • Yes but the special keystrokes are defined in external files and loaded into the map?! – matthias Jun 17 '14 at 10:46
  • @matthias Ignore my previous answer. Yes, the keyboard layouts are stored in text files as resources and then read in as needed – mikea Jun 17 '14 at 10:46