How to set umlaut (German ü symbol) as mnemonics for JComboBox

I used the following code:

JComboBox cb=new JComboBox(); JLabel label = new JLabel("für"); label.setDisplayedMnemonic('ü'); label.setLabelFor(cb); 

This code does not work. However, if I put the mnemonics on "f" instead of "ü", it works fine. There is an API in jdk7 that allows this, but I could not find such an API in jdk 6: JDK 7 api: http://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent. html # getExtendedKeyCodeForChar% 28int% 29

+4
source share
1 answer

DisplayedMnemonic is fine. "ü" is underlined, but:
This will installKeyboardActions() ine BasicLabelUI for the inputMap of your JLabel using KeyStroke: alt pressed UNKNOWN , which will definitely not work.

+3
source

Source: https://habr.com/ru/post/1383806/


All Articles