interface Mnemonicable
Modifier and Type | Method and Description |
---|---|
int |
getDisplayedMnemonicIndex()
Returns the character, as an index, that the look and feel should
provide decoration for as representing the mnemonic character.
|
int |
getMnemonic()
Returns the keyboard mnemonic for this component.
|
void |
setDisplayedMnemonicIndex(int index)
Provides a hint to the look and feel as to which character in the
text should be decorated to represent the mnemonic.
|
void |
setMnemonic(int mnemonic)
Sets the keyboard mnemonic on this component.
|
int getMnemonic()
void setMnemonic(int mnemonic)
A mnemonic must correspond to a single key on the keyboard and should be
specified using one of the VK_XXX
keycodes defined in
java.awt.event.KeyEvent
. Mnemonics are case-insensitive,
therefore a key event with the corresponding keycode would cause the
button to be activated whether or not the Shift modifier was pressed.
mnemonic
- the key code which represents the mnemonicKeyEvent
,
setDisplayedMnemonicIndex(int)
int getDisplayedMnemonicIndex()
setDisplayedMnemonicIndex(int)
void setDisplayedMnemonicIndex(int index) throws IllegalArgumentException
The value of this is updated as the properties relating to the
mnemonic change (such as the mnemonic itself, the text...).
You should only ever have to call this if
you do not wish the default character to be underlined. For example, if
the text was 'Save As', with a mnemonic of 'a', and you wanted the 'A'
to be decorated, as 'Save As', you would have to invoke
setDisplayedMnemonicIndex(5)
after invoking
setMnemonic(KeyEvent.VK_A)
.
index
- Index into the String to underlineIllegalArgumentException
- will be thrown if index
is >= length of the text, or < -1getDisplayedMnemonicIndex()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses