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 etc.
- chris
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.
>
> thanks,
> -Karthik.
>
> +------------------------------------------------------------------------+
> | Karthik Vishwanath | National Centre for Biological Sciences|
> | [EMAIL PROTECTED] | TIFR Centre, IISc Campus, PO Box 1234 |
> | 80-334-5615 or 4062 or 3035 | Bangalore 560012, INDIA |
> | Fax 80-334-3851 | |
> +------------------------------------------------------------------------+