The following source code snippet shows how to create a
JComboBox, set a simple
DefaultComboBoxModel on it, and most importantly, add an
ItemListener to it so your code can react to users changing the selection in the combobox.
The source code is written in Scala, but as you can see, it converts easily to Java: