Reputation:
I'm using Swing to create a hot key for all the menus. For Save As menu item The 'A' should be under lined instead of 'a' immediately following the S in Save as. I've used the following code to create hot keys for menuitems "for Save As Menu: MenuItem.setMnemonic('a');"
Upvotes: 1
Views: 66
Reputation: 285405
You'll want to use the setDisplayedMnemonicIndex(...)
to provide a hint to the JVM for which letter should get the underline. You invoke this after calling setMnemonic(KeyEvent.VK_A)
Please check out the API for more on this: AbstractButton API
Upvotes: 4