Top Description Inners Fields Constructors Methods
com.sun.javafx.scene.control.behavior

public Class MnemonicInfo

extends Object
Class Inheritance
Imports
javafx.scene.input.KeyEvent, .KeyCombination, java.util.Objects

Provides information about mnemonics contained within a string.

The syntax of the string content is as follows:

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
MnemonicInfo.MnemonicKeyCombination

A modified version of KeyCharacterCombination, which matches on the text property of a KeyEvent instead of on the KeyCode.

Field Summary

Modifier and TypeField and Description
private String
extendedMnemonicText

The extended mnemonic text (if it exists).

private String
mnemonic

The mnemonic or null if there is no mnemonic.

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.

Constructor Summary

AccessConstructor and Description
public
MnemonicInfo(String
the action text string
s
)

Creates a new MnemonicInfo instance from the given string.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the extended mnemonic text (if it exists) or null
getExtendedMnemonicText
()

Returns the extended mnemonic text (if it exists).

public String

Returns:

the mnemonic or null if there is no mnemonic
getMnemonic
()

Returns the mnemonic or null if there is no mnemonic.

public int

Returns:

the index of the mnemonic character in the text property or -1 if there is no mnemonic character in the text
getMnemonicIndex
()

Returns 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 or null if there is no mnemonic
getMnemonicKeyCombination
()

Returns the mnemonic KeyCombination or null if there is no mnemonic.

public String

Returns:

the text with any markup for the mnemonic and accelerator removed
getText
()

Returns 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
parseAndSplit(String s)

Parse and split the given string into the appropriate segments.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

extendedMnemonicTextback 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.

mnemonicback to summary
private String mnemonic

The mnemonic or null if there is no mnemonic.

MNEMONIC_SYMBOLback to summary
private final char MNEMONIC_SYMBOL

the marker symbol used when parsing for mnemonics

mnemonicIndexback 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 _c syntax was used to specify the mnemonic.

mnemonicKeyCombinationback to summary
private KeyCombination mnemonicKeyCombination
sourceTextback to summary
private String sourceText

The source text before mnemonic markup has been removed.

textback to summary
private String text

The text with any markup for the mnemonic and accelerator removed.

Constructor Detail

MnemonicInfoback to summary
public MnemonicInfo(String s)

Creates a new MnemonicInfo instance from the given string.

Parameters
s:String

the action text string

Method Detail

getExtendedMnemonicTextback 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.

Returns:String

the extended mnemonic text (if it exists) or null

getMnemonicback to summary
public String getMnemonic()

Returns the mnemonic or null if there is no mnemonic.

Returns:String

the mnemonic or null if there is no mnemonic

getMnemonicIndexback 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 _c syntax was used to specify the mnemonic.

Returns:int

the index of the mnemonic character in the text property or -1 if there is no mnemonic character in the text

getMnemonicKeyCombinationback to summary
public KeyCombination getMnemonicKeyCombination()

Returns the mnemonic KeyCombination or null if there is no mnemonic.

Returns:KeyCombination

the mnemonic KeyCombination or null if there is no mnemonic

getTextback to summary
public String getText()

Returns the text with any markup for the mnemonic and accelerator removed

Returns:String

the text with any markup for the mnemonic and accelerator removed

isEscapedMnemonicSymbolback to summary
private boolean isEscapedMnemonicSymbol(String s, int position)

Determines whether the string contains an escaped mnemonic symbol at the specified position.

isExtendedMnemonicback 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.

isSimpleMnemonicback 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.

parseAndSplitback to summary
private void parseAndSplit(String s)

Parse and split the given string into the appropriate segments.

updateback to summary
public void update(String s)
com.sun.javafx.scene.control.behavior back to summary

public Class MnemonicInfo.MnemonicKeyCombination

extends KeyCombination
Class Inheritance

A modified version of KeyCharacterCombination, which matches on the text property of a KeyEvent instead of on the KeyCode.

Field Summary

Modifier and TypeField and Description
private String
Inherited from javafx.scene.input.KeyCombination:
ALT_ANYALT_DOWNCONTROL_ANYCONTROL_DOWNMETA_ANYMETA_DOWNNO_MATCHSHIFT_ANYSHIFT_DOWNSHORTCUT_ANYSHORTCUT_DOWN

Constructor Summary

AccessConstructor and Description
public
MnemonicKeyCombination(String
the main key character
character
)

Constructs a MnemonicKeyCombination for the specified main key character.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the objects are equal, false otherwise
equals
(final Object
the object to compare to
obj
)

Overrides javafx.scene.input.KeyCombination.equals.

Tests whether this MnemonicKeyCombination equals to the specified object.

public final String

Returns:

The key character associated with this key combination
getCharacter
()

Gets the key character associated with this key combination.

public String

Returns:

the string representation of this MnemonicKeyCombination
getName
()

Overrides javafx.scene.input.KeyCombination.getName.

Returns a string representation of this MnemonicKeyCombination.

public int

Returns:

the hash code value
hashCode
()

Overrides javafx.scene.input.KeyCombination.hashCode.

Returns a hash code value for this MnemonicKeyCombination.

public boolean

Returns:

true if the key combinations match, false otherwise
match
(final KeyEvent
the key event
event
)

Overrides javafx.scene.input.KeyCombination.match.

Tests whether this key combination matches the key combination in the given KeyEvent.

Inherited from javafx.scene.input.KeyCombination:
getAltgetControlgetDisplayTextgetMetagetShiftgetShortcutkeyCombinationtoStringvalueOf

Field Detail

characterback to summary
private String character

Constructor Detail

MnemonicKeyCombinationback to summary
public MnemonicKeyCombination(String character)

Constructs a MnemonicKeyCombination for the specified main key character.

Parameters
character:String

the main key character

Method Detail

equalsback to summary
public boolean equals(final Object obj)

Overrides javafx.scene.input.KeyCombination.equals.

Tests whether this MnemonicKeyCombination equals to the specified object.

Parameters
obj:Object

the object to compare to

Returns:boolean

true if the objects are equal, false otherwise

Annotations
@Override
getCharacterback to summary
public final String getCharacter()

Gets the key character associated with this key combination.

Returns:String

The key character associated with this key combination

getNameback to summary
public String getName()

Overrides javafx.scene.input.KeyCombination.getName.

Returns a string representation of this MnemonicKeyCombination.

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 KeyCode name of a modifier key. It can be prefixed with the Ignored keyword. A non-prefixed modifier key implies its PRESSED value while the prefixed version implies the IGNORED value. If some modifier key is not specified in the string at all, it means it has the default RELEASED value.

The main key section contains the main key character enclosed in single quotes and is the last section in the returned string.

Returns:String

the string representation of this MnemonicKeyCombination

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides javafx.scene.input.KeyCombination.hashCode.

Returns a hash code value for this MnemonicKeyCombination.

Returns:int

the hash code value

Annotations
@Override
matchback to summary
public boolean match(final KeyEvent event)

Overrides javafx.scene.input.KeyCombination.match.

Tests whether this key combination matches the key combination in the given KeyEvent.

Parameters
event:KeyEvent

the key event

Returns:boolean

true if the key combinations match, false otherwise

Annotations
@Override