Forums Register Login
Refresh JComboBox
There's a combo box which displays items from the database and I delete it. I want to REFRESH it then and there.

I tried

Didnt work! What to do?

How are you deleting the data? Can you post your relevant code?
JComboBox (and JList, JTree and JTable) works with a model that contains the actual data. You'll need to remove from that and add again.
The code below is used to display the names of XSMeter in a combobox from the back-end.

After deletion I want to refresh the combobox so that the deleted file is removed from the combobox. Commented lines are what I thought would work but didnt! I have no clue how to go about!

Your code just fires the delete query on the DB, but does not delete from JComboBox
Oh oh! Tat was silly of me! Gotcha! Thanks for the info! I didn't notice it at all :p
You are welcome.
Don't worry about it. Happens to everyone

This thread has been viewed 9842 times.

All times above are in ranch (not your local) time.
The current ranch time is
Dec 15, 2018 11:50:12.