Package com.luciad.input
Class ModifierKeys
java.lang.Object
com.luciad.input.ModifierKeys
Utility class that contains the combination of the modifier keys pressed.
The modifiers keys are mapped to the following values:
- None => 0
- Alt => 1
- Ctrl => 2
- Shift => 4
- Note
- Don't use the
hasFlag
method if you want to check that there are no modifiers set, instead do
ModifierKeys shift = ModifierKeys.Shift; boolean checkNone = shift.equals(ModifierKeys.None); assertFalse(checkNone); ModifierKeys none = ModifierKeys.None; checkNone = none.equals(ModifierKeys.None); assertTrue(checkNone);
An example usage is:
ModifierKeys ctrl = ModifierKeys.Ctrl; ModifierKeys alt = ModifierKeys.Alt; ModifierKeys ctrlAlt = ctrl.or(alt); boolean isNone = ctrlAlt.equals(ModifierKeys.None); boolean isAlt = ctrlAlt.hasFlag(ModifierKeys.Alt); boolean isCtrlAlt = ctrlAlt.equals(ModifierKeys.Alt.or(ModifierKeys.Ctrl));
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ModifierKeys
AModifierKeys
instance that represents the Alt modifier key.static final ModifierKeys
AModifierKeys
instance that represents the Ctrl modifier key.static final ModifierKeys
AModifierKeys
instance that represents no modifier keys.static final ModifierKeys
AModifierKeys
instance that represents the Shift modifier key. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionand
(ModifierKeys other) boolean
long
getKeys()
Returns the combined pressed modifier keys.boolean
hasFlag
(ModifierKeys keys) Returns if the specified modifier keys are pressed.int
hashCode()
or
(ModifierKeys other)
-
Field Details
-
None
AModifierKeys
instance that represents no modifier keys. -
Alt
AModifierKeys
instance that represents the Alt modifier key. -
Ctrl
AModifierKeys
instance that represents the Ctrl modifier key. -
Shift
AModifierKeys
instance that represents the Shift modifier key.
-
-
Constructor Details
-
Method Details