Java articles‎ > ‎

Mnemonics on Mac

posted Dec 30, 2014, 5:58 AM by Sergey Malenkov   [ updated Dec 30, 2014, 7:29 AM ]

Many people got accustomed to using Alt+Key for mnemonics. However, this is the way to enter additional characters on Mac. To avoid confusion, Java introduced Ctrl+Alt+Key for mnemonics on Mac. Some time ago, Alt+Key was supported in IntelliJ IDEA on Mac by duplicating the corresponding Ctrl+Alt+Key.

This hack somehow worked with the Apple JDK. Alt+Key generated key events, which were processed by IDEA. If the corresponding mnemonics was available, it was used. Otherwise, the source component processed this event by itself. However, some key combinations, such as Alt+E or Alt+U in a text component, led to generating an input-method event instead of a key-typed event. These combinations were ignored even if a window had the corresponding mnemonics.

After migration from the Apple JDK 1.6 to the Oracle JDK 1.7, this hack stopped working. I partially fixed the issue, but mnemonics still doesn’t not work in text components, because almost all Alt+Key combinations generate input-method events instead of key-typed events. Theoretically, I can support the old behavior, but I do not want it. Moreover, I would like to remove the supporting Alt+Key combination for mnemonics on Mac.

I think we have to teach our users to use right key mappings, for example, via Tip of the Day. Also, our hack makes impossible to fix the issues for every keyboard layout, for example, this one. We are used to switch from Russian to English to enter different symbols, but it may not be that friendly for our German users.

What do you think? Should we preserve our hack for mnemonics? Would it be better to remove it?