So, I have a "Open Project" menu item, and I want to set mnemonic to it. I prefer it to be 'e' character from Project word. But when I set it with
openProjectMenuItem.setMnemonic('e');
it sets 'e' character from Open word as mnemonic. Is there a way to achieve what I want?
The method
setMnemonic(char mnemonic)
is obsolete, you should usesetMnemonic(int mnemonic)
with the appropriateVK_E
instead.In any case the default behaviour is to underline first occurrence of the letter, if present. If you want to customize this thing you should look at
AbstractButton
class, it has a method (doc here:that does exactly what you need. So: