This is a trick. most people would say ‘add a KeyListener to the JComboBox’ - but the right answer is ‘add a KeyListener to the JComboBox’s editor component.’
Swing components should be updated directly only in the context of callback methods invoked from the event dispatch thread.
A callback implementation like ActionListener.actionPerformed or MouseListener.mouseClicked is taking a long time to execute thereby blocking the event dispatch thread from processing other UI events.
The only thread-safe methods are repaint(), revalidate(), and invalidate()
The AWT event dispatcher thread is not a daemon thread. You must explicitly call System.exit to terminate the JVM.