public class ModifierMask
extends java.lang.Object
ModifierMask
represents a pattern that tells what modifier keys
are currently pressed. Modifier keys are keys like ctrl, shift or alt.InputEvent.getModifiersEx()
.Modifier and Type | Field and Description |
---|---|
static int |
KEY_MASK
all the masks for which a
ModifierMask looks out |
Constructor and Description |
---|
ModifierMask(int mask)
Creates a new mask which allows only modifiers that match exactly
mask . |
ModifierMask(int on,
int off)
Creates a new mask.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
getOffmask()
Gets the mask of the modifiers which must not be pressed.
|
int |
getOnmask()
Gets the mask of modifiers which must be pressed in order to
activate this.
|
int |
hashCode() |
boolean |
matches(int modifiers)
Tells whether this
ModifierMask relates to modifiers
or not. |
java.lang.String |
onMaskToString()
Creates a string that represents the on-mask.
|
void |
setOffmask(int offmask)
Sets the mask of the modifiers which must not be pressed in order to
activate this mask.
|
void |
setOnmask(int onmask)
Sets the mask of the modifiers which must be pressed in order to
activate this mask.
|
public static int KEY_MASK
ModifierMask
looks outpublic ModifierMask(int mask)
mask
.mask
- the mask to matchpublic ModifierMask(int on, int off)
on
- the keys that must be pressedoff
- the keys that must not be pressedpublic java.lang.String onMaskToString()
public boolean matches(int modifiers)
ModifierMask
relates to modifiers
or not. The modifiers
have the same form as
InputEvent.getModifiersEx()
would have.modifiers
- the modifiers from an InputEvent
true
if this mask matches the modifierspublic void setOnmask(int onmask)
onmask
- the modifiers that must be pressedpublic int getOnmask()
public void setOffmask(int offmask)
offmask
- the modifiers that must not be pressedpublic int getOffmask()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object