what is the code for clearing the list in java Applet programming using ItemListener method?
Printable View
what is the code for clearing the list in java Applet programming using ItemListener method?
ummm, what?
well see,in a program i have taken two combo box,one is for Country and another is for cities of the respective country.lets say for India i have taken four cities.while i m choosing India the four cities are automatically getting displayed as i have used ItemListener method but as many times i m selecting India the cities are getting added.can you please tell me why is it happening so?means i need to give a command for clearing the list in the combobox.if you need i will post the codes.
respond me please
Hi,
so the problem is when you select India on country box, you see cities getting populated; but if u select India once more you see the city list getting Appened to the list again?
and please post the code that wud be helpful
How are you storing the list data for the comboBox? If you're using a Vector, you can call Vector.clear() then add your cities to it. Then I believe calling JComboBox.validate() will update the display with the new values.