public static boolean isMiddleButton(MouseEvent e, Boolean ctrlDown, Boolean shiftDown, Boolean altDown)
    {
        return (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == 0 && 
               (e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) != 0 && 
               (e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == 0 && 
               (ctrlDown  == null || e.isControlDown() == ctrlDown)  &&
               (shiftDown == null || e.isShiftDown()   == shiftDown) && 
               (altDown   == null || e.isAltDown()     == altDown);
    }