Hi All, I am having strange problem getting the entered text in JComboBox. I am using getSelectedItem() for getting the entered text but it gives me the selected Item from the initially populated combo box.
Please tell me how to get the entered text. Regards, Vijay
That's what ItemListener is supposed to do... Replace the ItemListener with an ActionListener on your combo box to get the text when the user enters it. If the user enters text and then chooses something else in the ComboBox and then you want to see if they typed anything, you're going to have to add whatever the user typed to the ComboBox in your ActionListener so you can get it from the ComboBox... I don't think the default model saves what you type in the ComboBox by default...
Do something like this...
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad