JComboBox () { final ComboBox combobox = new ComboBox(myNameSuggestions); combobox.setEditable(true); combobox.setSelectedIndex(0); combobox.setMaximumRowCount(8); combobox.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { updateControls(); } } ); combobox.getEditor().getEditorComponent().addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { updateControls(); } @Override public void keyReleased(KeyEvent e) { updateControls(); } @Override public void keyTyped(KeyEvent e) { updateControls(); } } ); return combobox; }