Combo Box pop up and select using keyboard shortcuts
问题 public static void comboBoxActionPerform(JComboBox comboBox) { String ACTION_KEY = "myAction"; Action actionListener = new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { JComboBox source = (JComboBox) actionEvent.getSource(); source.showPopup(); source.setFocusable(true); } }; KeyStroke ctrlT = KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_MASK); InputMap inputMap = comboBox.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(ctrlT, ACTION