Package org.fest.swing.util
Class Modifiers
java.lang.Object
org.fest.swing.util.Modifiers
Understands utility methods related to input modifiers. This class also maps modifier masks to key codes for the
following modifiers:
- Alt
- AltGraph
- Control
- Meta
- Shift
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isModifier
(int keyCode) Indicates whether the given key code is a modifier.static int[]
keysFor
(int modifierMask) Returns the key codes for the given modifier mask.static int
maskFor
(int keyCode) Returns the modifier mask for the given key code.static int
updateModifierWithKeyCode
(int keyCode, int modifierMask) Updates the given modifier mask with the given key code, only if the given key code belongs to a modifier key.
-
Field Details
-
MODIFIER_TO_KEY
-
KEY_TO_MODIFIER
-
-
Constructor Details
-
Modifiers
private Modifiers()
-
-
Method Details
-
keysFor
public static int[] keysFor(int modifierMask) Returns the key codes for the given modifier mask.- Parameters:
modifierMask
- the given modifier mask.- Returns:
- the key codes for the given modifier mask.
-
isModifier
public static boolean isModifier(int keyCode) Indicates whether the given key code is a modifier.- Parameters:
keyCode
- the given key code.- Returns:
true
if the given key code is a modifier,false
otherwise.
-
maskFor
public static int maskFor(int keyCode) Returns the modifier mask for the given key code.- Parameters:
keyCode
- the given key code.- Returns:
- the modifier mask for the given key code.
- Throws:
IllegalArgumentException
- if the given key code is not a modifier.
-
updateModifierWithKeyCode
public static int updateModifierWithKeyCode(int keyCode, int modifierMask) Updates the given modifier mask with the given key code, only if the given key code belongs to a modifier key.- Parameters:
keyCode
- the given key code.modifierMask
- the given modifier mask.- Returns:
- the updated modifier mask.
-