Selecting a JComboBox item programmatically is pretty simple. Call either setSelectedIndex() or setSelectedItem() and that’s it. Problem is though, if you added an ItemListener to the JComboBox object, every time you do a select programmatically, the ItemStateChanged event method also gets affected.
Calling those two select methods from a JComboBox object is the most prone thing that developers do. However, if you do not want the ItemStateChanged method to be affected when you select an item programmatically, you can create a dummy variable inside the ItemStateChanged method so that it would not get affected. Sad to say, that is the alternative aside from adding and removing the ItemListener.