JComboBox - Set the selection programatically at runtime
posted 12 years ago
I am using an Editable JComboBox containing predefined entries. If the user types in a new entry add it. If it is empty then show a warning that it cannot be empty and set it to the previous selected string.
I tried this in ActionListner. Every time the comboChanged event is triggered I check for emty string if not then store the selectedItem as oldString. So on comboEdited I write