0

How can I check the state of the mouse buttons in Java? I cannot use mouse events, as it involves getting 'mouse released' on an element that has never received 'mouse pressed', so I theoretically could use events if it intercepted mouse events system wide, but that would probably be a security risk. If I can't do this with java, I am happy to write a native interface, and I am developing on Mac 10.6.

enbug
  • 3
  • 2
  • AFAIK mouseReleased() actually gets called on the same element that originally received mousePressed(). Even if not, you can always have a boolean to track whether an element was pressed so you know how to deal with release – iluxa Apr 01 '11 at 22:30

1 Answers1

1

Three words:

Global Event Listeners

Kerem Baydoğan
  • 10,475
  • 1
  • 43
  • 50