Package edu.umd.cs.findbugs.gui
Class AnnotatedString
java.lang.Object
edu.umd.cs.findbugs.gui.AnnotatedString
Class to handle Strings annotated with embedded mnemonics
Note: Since the human interface guidelines for Mac OS X say never to use
mnemonics, this class behaves as if no mnemonics are set when run on Mac OS
X.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Return the appropriate mnemonic character for this string.int
static void
localiseButton
(AbstractButton button, String key, String defaultString, boolean setMnemonic) Localise the given AbstractButton, setting the text and optionally mnemonic Note that AbstractButton includes menus and menu items.static void
toString()
-
Constructor Details
-
AnnotatedString
-
-
Method Details
-
toString
-
getMnemonic
public int getMnemonic()Return the appropriate mnemonic character for this string. If no mnemonic should be displayed, KeyEvent.VK_UNDEFINED is returned.- Returns:
- the Mnemonic character, or VK_UNDEFINED if no mnemonic should be set
-
getMnemonicIndex
public int getMnemonicIndex()- Returns:
- the index in the plain string at which the mnemonic should be displayed, or -1 if no mnemonic should be set
-
main
-
localiseButton
public static void localiseButton(AbstractButton button, String key, String defaultString, boolean setMnemonic) Localise the given AbstractButton, setting the text and optionally mnemonic Note that AbstractButton includes menus and menu items.- Parameters:
button
- The button to localisekey
- The key to look up in resource bundledefaultString
- default String to use if key not foundsetMnemonic
- whether or not to set the mnemonic. According to Sun's guidelines, default/cancel buttons should not have mnemonics but instead should use Return/Escape
-