I experimented with java.awt.event.MouseEvent
and mouse buttons and modifier keys. Finally I came to a point, where I was confused by its behavior.
Normally I use SwingUtilities.isLeftMouseButton(...)
etc. to detect, which mouse button is pressed and <MouseEvent>.isControlDown()
etc. to detect, which modifier key is pressed.
But if I press the middle mouse button, the <MouseEvent>.isAltDown()
-method seems to be always true, no matter the Alt-key is pressed or not (by the way same for right mouse button and meta key).
It seems some keys on keyboard share the same event flags as some mouse buttons. How to fetch the middle mouse button in java? seems to confirm my assumption.
So my question: Is there a way to detect which mouse button is pressed and which modifiers are really pressed? Or is it better to use only Ctrl and Shift modifier keys for conditional mouse events?
OS: Windows 8, java version "1.7.0_09"
Thank you in advance