From the java website:
BUTTON1_DOWN_MASK = The Mouse Button1 extended modifier constant.
BUTTON1_MASK = The Mouse Button1 modifier constant.
I'm not even sure what a "modifier constant" is. Let alone an extended one.
I do understand however that BUTTON1_MASK
is just the integer representation for when the left mouse button is clicked.
As the docs state,
BUTTON1_MASK
andBUTTON1_DOWN_MASK
are modifier constants, i.e. they are use in conjunction withMouseEvent#getModifiers
. They are not extended but rather used as a mask values, for exampleBUTTON1_DOWN_MASK
is used to detect the state of the mouse button whereas theBUTTON1_MASK
simply helps to determine which button is pressed.BUTTON1_MASK
is the mask indicating an event came from button 1.BUTTON1_DOWN_MASK
is conceptually similar, but is the extended version of that constant.There are two methods that return such sets of constants:
InputEvent#getModifiers()
andInputEvent#getModifiersEx()
, and they will return modifier constants, or extended modifier constants, respectively.From the docs (bold is mine):
and also (bold is mine):
If all you want is to detect a button 1 (normally, left) click, then either of these should work:
Also, you can check out this open source version of
InputEvent
, which has some more useful comments, and shows what's happening inside