public static void attach() { if (sharedInstance == null) { sharedInstance = new MenuKeyBindingProcessor(); } if (numInstallations == 0) { DefaultFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(sharedInstance); } numInstallations++; }
public static void detach() { if (numInstallations == 1) { DefaultFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(sharedInstance); } if (numInstallations > 0) { numInstallations--; } }