[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

About MouseListener

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
dyma82
Asked:
dyma82
  • 2
1 Solution
 
rkenworthyCommented:
Source code from javax.swing.SwingUtilities:

    public static boolean isRightMouseButton(MouseEvent anEvent) {
        return ((anEvent.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK);
    }
0
 
kylarCommented:
Also, if you want to make a popup menu there is always the isPopupTrigger() call.

Cheers,
Kylar

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now