void (JComponent component) { @NlsSafe String actionName = "FCB_ENTER"; Action action = new AbstractAction(actionName) { private static final long serialVersionUID = 6926912268574067920L; @Override public void actionPerformed(ActionEvent e) { if (popup.isPopupFocused()) { popupSelection(popup.getSelection()); } else { // use update instead of checkChanges, in case it // is needed to reset the icon of a CustomChoice filter.consolidateFilter(); } popup.hide(); } }; component.getActionMap().put(actionName, action); component.getInputMap(JComponent.WHEN_FOCUSED) .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), actionName); }