Top Description Fields Constructors Methods
javafx.scene.input

public final Class KeyCodeCombination

extends KeyCombination
Class Inheritance
Imports
javafx.beans.NamedArg

This class represents a key combination in which the main key is specified by its KeyCode. Such key combination is independent on the keyboard functional layout configured by the user at the time of key combination matching.
Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private KeyCode
code

The key code associated with this key combination.

Inherited from javafx.scene.input.KeyCombination:
ALT_ANYALT_DOWNCONTROL_ANYCONTROL_DOWNMETA_ANYMETA_DOWNNO_MATCHSHIFT_ANYSHIFT_DOWNSHORTCUT_ANYSHORTCUT_DOWN

Constructor Summary

AccessConstructor and Description
public
KeyCodeCombination(final KeyCode
the key code of the main key
code
,
final KeyCombination.ModifierValue
the value of the shift modifier key
shift
,
final KeyCombination.ModifierValue
the value of the control modifier key
control
,
final KeyCombination.ModifierValue
the value of the alt modifier key
alt
,
final KeyCombination.ModifierValue
the value of the meta modifier key
meta
,
final KeyCombination.ModifierValue
the value of the shortcut modifier key
shortcut
)

Constructs a KeyCodeCombination for the specified main key and with an explicit specification of all modifier keys.

public
KeyCodeCombination(final KeyCode
the key code of the main key
code
,
final KeyCombination.Modifier...
the list of modifier keys and their corresponding values
modifiers
)

Constructs a KeyCodeCombination for the specified main key and with the specified list of modifiers.

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 KeyCodeCombination equals to the specified object.

public final KeyCode

Returns:

The key code associated with this key combination
getCode
()

Gets the key code associated with this key combination.

public String
getDisplayText()

Overrides javafx.scene.input.KeyCombination.getDisplayText.

Returns a string representation of this KeyCombination that is suitable for display in a user interface (for example, beside a menu item).

public String

Returns:

the string representation of this KeyCodeCombination
getName
()

Overrides javafx.scene.input.KeyCombination.getName.

Returns a string representation of this KeyCodeCombination.

private static char
getSingleChar(KeyCode code)

Compute a single suitable char summarizing the code, if any, and 0 otherwise.

public int

Returns:

the hash code value
hashCode
()

Overrides javafx.scene.input.KeyCombination.hashCode.

Returns a hash code value for this KeyCodeCombination.

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.

private static void
validateKeyCode(final KeyCode keyCode)

Inherited from javafx.scene.input.KeyCombination:
getAltgetControlgetMetagetModifiergetShiftgetShortcutkeyCombinationtoStringvalueOf

Field Detail

codeback to summary
private KeyCode code

The key code associated with this key combination.

Constructor Detail

KeyCodeCombinationback to summary
public KeyCodeCombination(final KeyCode code, final KeyCombination.ModifierValue shift, final KeyCombination.ModifierValue control, final KeyCombination.ModifierValue alt, final KeyCombination.ModifierValue meta, final KeyCombination.ModifierValue shortcut)

Constructs a KeyCodeCombination for the specified main key and with an explicit specification of all modifier keys. Each modifier key can be set to PRESSED, RELEASED or IGNORED.

Parameters
code:KeyCode

the key code of the main key

shift:KeyCombination.ModifierValue

the value of the shift modifier key

control:KeyCombination.ModifierValue

the value of the control modifier key

alt:KeyCombination.ModifierValue

the value of the alt modifier key

meta:KeyCombination.ModifierValue

the value of the meta modifier key

shortcut:KeyCombination.ModifierValue

the value of the shortcut modifier key

KeyCodeCombinationback to summary
public KeyCodeCombination(final KeyCode code, final KeyCombination.Modifier... modifiers)

Constructs a KeyCodeCombination for the specified main key and with the specified list of modifiers. All modifier keys which are not explicitly listed are set to the default RELEASED value.

All possible modifiers which change the default modifier value are defined as constants in the KeyCombination class.

Parameters
code:KeyCode

the key code of the main key

modifiers:KeyCombination.Modifier[]

the list of modifier keys and their corresponding values

Method Detail

equalsback to summary
public boolean equals(final Object obj)

Overrides javafx.scene.input.KeyCombination.equals.

Tests whether this KeyCodeCombination 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
getCodeback to summary
public final KeyCode getCode()

Gets the key code associated with this key combination.

Returns:KeyCode

The key code associated with this key combination

getDisplayTextback to summary
public String getDisplayText()

Overrides javafx.scene.input.KeyCombination.getDisplayText.

Doc from javafx.scene.input.KeyCombination.getDisplayText.

Returns a string representation of this KeyCombination that is suitable for display in a user interface (for example, beside a menu item).

Returns:String

A string representation of this KeyCombination, suitable for display in a user interface.

Annotations
@Override
getNameback to summary
public String getName()

Overrides javafx.scene.input.KeyCombination.getName.

Returns a string representation of this KeyCodeCombination.

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 key code name of the main key and is the last section in the returned string.

Returns:String

the string representation of this KeyCodeCombination

Annotations
@Override
getSingleCharback to summary
private static char getSingleChar(KeyCode code)

Compute a single suitable char summarizing the code, if any, and 0 otherwise.

hashCodeback to summary
public int hashCode()

Overrides javafx.scene.input.KeyCombination.hashCode.

Returns a hash code value for this KeyCodeCombination.

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. It uses only the key code and the state of the modifier keys from the KeyEvent in the test. This means that the method can return true only for KEY_PRESSED and KEY_RELEASED events, but not for KEY_TYPED events, which don't have valid key codes.

Parameters
event:KeyEvent

the key event

Returns:boolean

true if the key combinations match, false otherwise

Annotations
@Override
validateKeyCodeback to summary
private static void validateKeyCode(final KeyCode keyCode)