The syntax of the string content is as follows:
Simple mnemonic: the first character preceded by the first _
character will be treated as the mnemonic. For example, "E_xit" will cause
the text to become "Exit" and the mnemonic will be "x". This is the most
common designation of a mnemonic, and the skin for a control will present the
mnemonic in the string with an underline. To prevent _ from being
treated as the mnemonic prefix character, repeat it twice in a row. A
mnemonic is not required.
Extended mnemonic: an optional representation of a mnemonic is
_(c), where c is the mnemonic character. For example,
"Exit_(q)" will cause the text to become "Exit" and the
extendedMnemonicText to become "(q)". This is typically provided in
translated strings to support mnemonics where the main text does not have any
characters that map to keyboard keys. In these cases, the skin for the
control will typically present the mnemonic surrounded by parentheses. The
skin will also honor the hiding and presentation of the extended mnemonic
string on platforms where the mnemonic is only displayed when the mnemonic
modifier key is pressed.
| Modifier and Type | Class and Description |
|---|---|
| public static class | MnemonicInfo.
A modified version of KeyCharacterCombination, which matches on the text property of a KeyEvent instead of on the KeyCode. |
| Modifier and Type | Field and Description |
|---|---|
| private String | extendedMnemonicText
The extended mnemonic text (if it exists). |
| private String | mnemonic
The mnemonic or |
| private final char | MNEMONIC_SYMBOL
the marker symbol used when parsing for mnemonics |
| private int | mnemonicIndex
The index of the mnemonic character in the text property or -1 if there is no mnemonic character in the text. |
| private KeyCombination | |
| private String | sourceText
The source text before mnemonic markup has been removed. |
| private String | text
The text with any markup for the mnemonic and accelerator removed. |
| Access | Constructor and Description |
|---|---|
| public | MnemonicInfo(String
the action text string s)Creates a new MnemonicInfo instance from the given string. |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: the extended mnemonic text (if it exists) or nullReturns the extended mnemonic text (if it exists). |
| public String | Returns: the mnemonic ornull if there is no
mnemonicReturns the mnemonic or |
| public int | Returns: the index of the mnemonic character in the text property or -1 if there is no mnemonic character in the textReturns the index of the mnemonic character in the text property or -1 if there is no mnemonic character in the text. |
| public KeyCombination | Returns: the mnemonic KeyCombination ornull if there is no
mnemonicReturns the mnemonic KeyCombination or |
| public String | Returns: the text with any markup for the mnemonic and accelerator removedReturns the text with any markup for the mnemonic and accelerator removed |
| private boolean | isEscapedMnemonicSymbol(String s, int position)
Determines whether the string contains an escaped mnemonic symbol at the specified position. |
| private boolean | isExtendedMnemonic(String s, int position)
Determines whether the string contains an extended mnemonic at the specified position. |
| private boolean | isSimpleMnemonic(String s, int position)
Determines whether the string contains a simple mnemonic at the specified position. |
| private void | |
| public void |
| extendedMnemonicText | back to summary |
|---|---|
| private String extendedMnemonicText The extended mnemonic text (if it exists). This is only non-null if the extended mnemonic syntax was used to specify the mnemonic. | |
| mnemonic | back to summary |
|---|---|
| private String mnemonic The mnemonic or | |
| MNEMONIC_SYMBOL | back to summary |
|---|---|
| private final char MNEMONIC_SYMBOL the marker symbol used when parsing for mnemonics | |
| mnemonicIndex | back to summary |
|---|---|
| private int mnemonicIndex The index of the mnemonic character in the text property or -1 if there
is no mnemonic character in the text. This is only non-negative if the
simple | |
| mnemonicKeyCombination | back to summary |
|---|---|
| private KeyCombination mnemonicKeyCombination | |
| sourceText | back to summary |
|---|---|
| private String sourceText The source text before mnemonic markup has been removed. | |
| text | back to summary |
|---|---|
| private String text The text with any markup for the mnemonic and accelerator removed. | |
| MnemonicInfo | back to summary |
|---|---|
| public MnemonicInfo(String s) Creates a new MnemonicInfo instance from the given string.
| |
| getExtendedMnemonicText | back to summary |
|---|---|
| public String getExtendedMnemonicText() Returns the extended mnemonic text (if it exists). This is only non-null if the extended mnemonic syntax was used to specify the mnemonic.
| |
| getMnemonic | back to summary |
|---|---|
| public String getMnemonic() Returns the mnemonic or
| |
| getMnemonicIndex | back to summary |
|---|---|
| public int getMnemonicIndex() Returns the index of the mnemonic character in the text property or -1 if
there is no mnemonic character in the text. This is only non-negative if
the simple
| |
| getMnemonicKeyCombination | back to summary |
|---|---|
| public KeyCombination getMnemonicKeyCombination() Returns the mnemonic KeyCombination or
| |
| getText | back to summary |
|---|---|
| public String getText() Returns the text with any markup for the mnemonic and accelerator removed
| |
| isEscapedMnemonicSymbol | back to summary |
|---|---|
| private boolean isEscapedMnemonicSymbol(String s, int position) Determines whether the string contains an escaped mnemonic symbol at the specified position. | |
| isExtendedMnemonic | back to summary |
|---|---|
| private boolean isExtendedMnemonic(String s, int position) Determines whether the string contains an extended mnemonic at the specified position. An extended mnemonic is any four-character string similar to "_(x)", where x is any character except whitespace. | |
| isSimpleMnemonic | back to summary |
|---|---|
| private boolean isSimpleMnemonic(String s, int position) Determines whether the string contains a simple mnemonic at the specified position. A simple mnemonic is any two-character string similar to "_x", where x is not an underscore or a whitespace character. | |
| parseAndSplit | back to summary |
|---|---|
| private void parseAndSplit(String s) Parse and split the given string into the appropriate segments. | |
| update | back to summary |
|---|---|
| public void update(String s) | |
| Modifier and Type | Field and Description |
|---|---|
| private String |
| Access | Constructor and Description |
|---|---|
| public | MnemonicKeyCombination(String
the main key character character)Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the objects are equal, false otherwisethe object to compare to obj)Overrides javafx. Tests whether this |
| public final String | Returns: The key character associated with this key combinationGets the key character associated with this key combination. |
| public String | Returns: the string representation of thisMnemonicKeyCombinationOverrides javafx. Returns a string representation of this |
| public int | Returns: the hash code valueOverrides javafx. Returns a hash code value for this |
| public boolean | Returns: true if the key combinations match, false
otherwisethe key event event)Overrides javafx. Tests whether this key combination matches the key combination in the
given |
| character | back to summary |
|---|---|
| private String character | |
| MnemonicKeyCombination | back to summary |
|---|---|
| public MnemonicKeyCombination(String character) Constructs a
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides javafx. Tests whether this | |
| getCharacter | back to summary |
|---|---|
| public final String getCharacter() Gets the key character associated with this key combination.
| |
| getName | back to summary |
|---|---|
| public String getName() Overrides javafx. Returns a string representation of this The string representation consists of sections separated by plus characters. Each section specifies either a modifier key or the main key.
A modifier key section contains the The main key section contains the main key character enclosed in single quotes and is the last section in the returned string. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides javafx. Returns a hash code value for this
| |
| match | back to summary |
|---|---|
| public boolean match(final KeyEvent event) Overrides javafx. Tests whether this key combination matches the key combination in the
given | |