public static boolean isRightClick(MouseEvent e){
  boolean result;
  result=false;
  if ((e.getButton() == MouseEvent.BUTTON3) && (e.getClickCount() == 1))   result=true;
 else   if ((e.getButton() == MouseEvent.BUTTON1) && e.isAltDown() && !e.isShiftDown()&& !e.isControlDown())   result=true;
  return result;
}

public static boolean isRightClick ( MouseEvent e ) { boolean result ; result = false ; if ( ( e . getButton ( ) == MouseEvent . BUTTON3 ) && ( e . getClickCount ( ) == 1 ) ) result = true ; else if ( ( e . getButton ( ) == MouseEvent . BUTTON1 ) && e . isAltDown ( ) && ! e . isShiftDown ( ) && ! e . isControlDown ( ) ) result = true ; return result ; }
checks whether the mouse event is a right - click event . alt + left - click is also interpreted as right - click .
