public static boolean isMiddleClick(MouseEvent e){
  return ((e.getButton() == MouseEvent.BUTTON2) && (e.getClickCount() == 1));
}

public static boolean isMiddleClick ( MouseEvent e ) { return ( ( e . getButton ( ) == MouseEvent . BUTTON2 ) && ( e . getClickCount ( ) == 1 ) ) ; }
checks whether the mouse event is a middle / wheel - click event . ctrl / alt / shift are allowed .
