java.lang.Object
javafx.scene.input.KeyCombination
javafx.scene.input.KeyCharacterCombination
This class represents a key combination in which the main key is specified
 by its character. Such key combination is dependent on the keyboard
 functional layout configured by the user at the time of key combination
 matching.
- Since:
- JavaFX 2.0
- 
Nested Class SummaryNested classes/interfaces declared in class javafx.scene.input.KeyCombinationKeyCombination.Modifier, KeyCombination.ModifierValue
- 
Field SummaryFields declared in class javafx.scene.input.KeyCombinationALT_ANY, ALT_DOWN, CONTROL_ANY, CONTROL_DOWN, META_ANY, META_DOWN, NO_MATCH, SHIFT_ANY, SHIFT_DOWN, SHORTCUT_ANY, SHORTCUT_DOWN
- 
Constructor SummaryConstructorsConstructorDescriptionKeyCharacterCombination(String character, KeyCombination.Modifier... modifiers) Constructs aKeyCharacterCombinationfor the specified main key character and the specified list of modifiers.KeyCharacterCombination(String character, KeyCombination.ModifierValue shift, KeyCombination.ModifierValue control, KeyCombination.ModifierValue alt, KeyCombination.ModifierValue meta, KeyCombination.ModifierValue shortcut) Constructs aKeyCharacterCombinationfor the specified main key character and with an explicit specification of all modifier keys.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanTests whether thisKeyCharacterCombinationequals to the specified object.final StringGets the key character associated with this key combination.getName()Returns a string representation of thisKeyCharacterCombination.inthashCode()Returns a hash code value for thisKeyCharacterCombination.booleanTests whether this key combination matches the key combination in the givenKeyEvent.Methods declared in class javafx.scene.input.KeyCombinationgetAlt, getControl, getDisplayText, getMeta, getShift, getShortcut, keyCombination, toString, valueOf
- 
Constructor Details- 
KeyCharacterCombinationpublic KeyCharacterCombination(String character, KeyCombination.ModifierValue shift, KeyCombination.ModifierValue control, KeyCombination.ModifierValue alt, KeyCombination.ModifierValue meta, KeyCombination.ModifierValue shortcut) Constructs aKeyCharacterCombinationfor the specified main key character and with an explicit specification of all modifier keys. Each modifier key can be set toPRESSED,RELEASEDorIGNORED.- Parameters:
- character- the main key character
- shift- the value of the- shiftmodifier key
- control- the value of the- controlmodifier key
- alt- the value of the- altmodifier key
- meta- the value of the- metamodifier key
- shortcut- the value of the- shortcutmodifier key
 
- 
KeyCharacterCombinationConstructs aKeyCharacterCombinationfor the specified main key character and the specified list of modifiers. All modifier keys which are not explicitly listed are set to the defaultRELEASEDvalue.All possible modifiers which change the default modifier value are defined as constants in the KeyCombinationclass.- Parameters:
- character- the main key character
- modifiers- the list of modifier keys and their corresponding values
 
 
- 
- 
Method Details- 
getCharacterGets the key character associated with this key combination.- Returns:
- The key character associated with this key combination
 
- 
matchTests whether this key combination matches the key combination in the givenKeyEvent. The key character of this object is first translated to the key code which is capable of producing the character in the current keyboard layout and then the resulting key code together with the modifier keys are matched against the key code and key modifiers from theKeyEvent. This means that the method can returntrueonly forKEY_PRESSEDandKEY_RELEASEDevents, but not forKEY_TYPEDevents, which don't have valid key codes.- Overrides:
- matchin class- KeyCombination
- Parameters:
- event- the key event
- Returns:
- trueif the key combinations match,- falseotherwise
 
- 
getNameReturns a string representation of thisKeyCharacterCombination.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 KeyCodename of a modifier key. It can be prefixed with theIgnoredkeyword. A non-prefixed modifier key implies itsPRESSEDvalue while the prefixed version implies theIGNOREDvalue. If some modifier key is not specified in the string at all, it means it has the defaultRELEASEDvalue.The main key section contains the main key character enclosed in single quotes and is the last section in the returned string. - Overrides:
- getNamein class- KeyCombination
- Returns:
- the string representation of this KeyCharacterCombination
 
- 
equalsTests whether thisKeyCharacterCombinationequals to the specified object.- Overrides:
- equalsin class- KeyCombination
- Parameters:
- obj- the object to compare to
- Returns:
- trueif the objects are equal,- falseotherwise
 
- 
hashCodepublic int hashCode()Returns a hash code value for thisKeyCharacterCombination.- Overrides:
- hashCodein class- KeyCombination
- Returns:
- the hash code value
 
 
-