Java - Mnemonic underline position

106 views Asked by At

Say I have a JMenuItem who's name is "This is a Test". If I want to set it's mnemonic to 'T', it automatically underlines the first T in "This". Can I change this, so it underlines the T in "Test" instead?

1

There are 1 answers

0
Hovercraft Full Of Eels On

Simply call setDisplayedMnemonicIndex(int index) on your JMenuItem or on any object of a class derived from AbstractButton. See the API listing for this.