Java Mouse Event Right Click

DD. picture DD. · Dec 24, 2010 · Viewed 125.3k times · Source

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

Is this the case on a two button mouse?

Thanks

Answer

barjak picture barjak · Dec 24, 2010

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

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