I have a swing app where I am using (among other things obviously) an editable JComboBox and a jButton.

when the JButton is clicked, it does some processing and uses the value in the JComboBox as one of it's inputs. I'm finding that everything is fine when:

- The value of the combobox is changed via the drop down
- The value of the combox is changed by typing AND the user either tabs or clicks on another field

however, if the user changes the value of the combobox by typing and then clicks on the button, the OLD value of what was in the combox is what the JButton sees when doing the getSelectedItem(). If the user clicks on the button a second time, then the new value is available via the getSelectedItem().

is this a known issue or are there any workarounds available? i was thinking that when the user clicks the button I would just 'pretend/force a focus change' as if the user had clicked on another field prior to hitting the button.

Any recommendations would be welcome.

This question has already been answered. Start a new discussion instead.