Java: Mnemonics and Unicode
I am currently having problems with unicode and mnemonics in a Java SE application. In the menu bar i added a menu with the name "ФMnemonicUnicodeTest" and the first letter is set as Mnemonic.
The integer value which is set as mnemonic is "1060".- Windows 7
- English system language
- Java SE 6, 32bit
- Russian / Russian k开发者_Python百科eyboard layout
- Physical russian keyboard
Code:
menu.setMnemonic((int)(text.substring(index+1, index+2).charAt(0)));
The menu is displayed correctly (mnemonic character is underlined).
But the mnemonic does not expand the menu with "ALT + Ф" (the key is displayed at the physical keybpard as "AФ").My question is: Why is the mnemonic not working and how can it be fixed?
Long time I haven't been doing this, but I think that for menu shortcuts, you need to use one of the virtual key values.
You might get more information in the KeyEvent javadoc.
精彩评论