MouseShortcut (MouseEvent event) { int button = MouseShortcut.getButton(event); int clickCount = event instanceof MouseWheelEvent ? 1 : event.getClickCount(); if (0 <= button && clickCount <= myClickCount) { int modifiers = event.getModifiersEx(); return new MouseShortcut(button, modifiers, clickCount); } return null; }