static AutoCloseable tempAddKeyEventDispatcher(final KeyEventDispatcher d) { final FocusManager fm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); fm.addKeyEventDispatcher(d); ret autoCloseable { fm.removeKeyEventDispatcher(d); }; }