Solved

About MouseListener

Posted on 2001-07-06
4
184 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now