[SOLVED ] Getting the Selected Value in JComboBox
So I'm looking for a way to check if the certain value of a JComboBox is selected.
I've tried event.getSource() == comboBox.getSelectedItem()
But it's not going to work since I don't specify which value I want it to equal to.
If my list is:
I know Hello has a int value of = 0;
How would I check if the Hello value is highlighted?
Re: Getting the Selected Value in JComboBox
As always, the API is your best friend: JComboBox (Java Platform SE 6)
Re: [SOLVED ] Getting the Selected Value in JComboBox
- cast the selected item object to a String object.
- compared the casted String to the "Hello" string.