Java Mouse Event Right Click

By | July 2, 2019


On my three button mouse MouseEvent.BUTTON2= Middle Click and MouseEvent.BUTTON3 = Right Click.

Is this the case on a two button mouse?



To avoid any ambiguity, use the utilities methods from SwingUtilities :

SwingUtilities.isLeftMouseButton(MouseEvent anEvent)
SwingUtilities.isRightMouseButton(MouseEvent anEvent)
SwingUtilities.isMiddleMouseButton(MouseEvent anEvent)

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *