Solved

About MouseListener

Posted on 2001-07-06
4
189 Views
Last Modified: 2011-10-03
How can I respond to the event of clicking with the RIGHT button of the mouse.

I already have a MouseListener set up, but the MouseEvent it give me does not have any means to find out if the user clicked with the right button or with the left button.

Any way to do this?????????????

Thanks in advance.
0
Comment
Question by:dyma82
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
rkenworthy earned 50 total points
ID: 6260052
Source code from javax.swing.SwingUtilities:

    public static boolean isRightMouseButton(MouseEvent anEvent) {
        return ((anEvent.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK);
    }
0
 
LVL 4

Expert Comment

by:kylar
ID: 6260087
Also, if you want to make a popup menu there is always the isPopupTrigger() call.

Cheers,
Kylar

0
 
LVL 5

Expert Comment

by:Netminder
ID: 6853409
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6887706
Admin notified of User neglect. Force-accepted by
Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 74
Problem to Alipay 10 67
java mysql insert application 14 41
IBM TS2900 (3572) Tape Autoloader Java? 12 55
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question