On Sat, 14 Nov 1998, Karthik Vishwanath wrote:
> Hi all,
> On receiving a mousePressed, how does one determine which mouse
> button is the one clicked?
>
> ps: i am sorry if this is a purely java based question, but then i do not
> know where else i can post it.
>
See
javap java.awt
Just in case you want to use this to pop up a popup menu, the way
NOT to do it is to check for button 3 from the mouse, as this is
not portable (ever checked how many buttons a Mac mouse has?).
Instead, you should check whether this is a popup mouse click, using
something like this inside BOTH o
Karthik,
Assume you have MouseEvent in a variable "event"
int m = event.getModifiers();
if (m & InputEvent.BUTTON1_MASK) <- detects button 1
Take a look at InputEvents - it has a lot of static
constants used for determining which button was pressed, if
CTRL, ALT or SHIFT were pressed, also
Hi all,
On receiving a mousePressed, how does one determine which mouse
button is the one clicked?
ps: i am sorry if this is a purely java based question, but then i do not
know where else i can post it.
thanks,
-Karthik.
+---