void (JComponent component) { @NlsSafe String actionName = "FCB_UP_CTRL"; Action action = new AbstractAction(actionName) { private static final long serialVersionUID = 746565926592574009L; @Override public void actionPerformed(ActionEvent e) { // if focus is on the popup: move from choices to history, and, // being already on history, up to text field. if (popup.isPopupFocused()) { if (!popup.selectUp(true)) { popup.setPopupFocused(false); } } } }; component.getActionMap().put(actionName, action); component.getInputMap(JComponent.WHEN_FOCUSED) .put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_MASK), actionName); }