Returns the extended modifier mask for this event.
Extended modifiers are the modifiers that ends with the _DOWN_MASK suffix, such as ALT_DOWN_MASK, BUTTON1_DOWN_MASK, and others.
Extended modifiers represent the state of all modal keys, such as ALT, CTRL, META, and the mouse buttons just after the event occurred.
For example, if the user presses button 1 followed by button 2 , and then releases them in the same order, the following sequence of events is generated:
MOUSE_PRESSED
: BUTTON1_DOWN_MASK
MOUSE_PRESSED
: BUTTON1_DOWN_MASK | BUTTON2_DOWN_MASK
MOUSE_RELEASED
: BUTTON2_DOWN_MASK
MOUSE_CLICKED
: BUTTON2_DOWN_MASK
MOUSE_RELEASED
:
MOUSE_CLICKED
:
It is not recommended to compare the return value of this method using ==
because new modifiers can be added in the future. For example, the appropriate way to check that SHIFT and BUTTON1 are down, but CTRL is up is demonstrated by the following code:
int onmask = SHIFT_DOWN_MASK | BUTTON1_DOWN_MASK;
int offmask = CTRL_DOWN_MASK;
if ((event.getModifiersEx() & (onmask | offmask)) == onmask) {
...
}
The above code will work even if new modifiers are added.
getModifiersEx()
be used instead