| Author |
Refresh JComboBox
|
Sandeep Swaminathan
Ranch Hand
Joined: Apr 23, 2008
Posts: 52
|
|
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
jcbCombo.updateUI();
jcbCombo.repaint();
jcbCombo.revalidate();
Didnt work! What to do?
|
Music is all around us. All you have to do is just LISTEN to it,
Sandeep Swaminathan
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8441
|
|
|
How are you deleting the data? Can you post your relevant code?
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
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.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Sandeep Swaminathan
Ranch Hand
Joined: Apr 23, 2008
Posts: 52
|
|
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!
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8441
|
|
|
Your code just fires the delete query on the DB, but does not delete from JComboBox
|
 |
Sandeep Swaminathan
Ranch Hand
Joined: Apr 23, 2008
Posts: 52
|
|
|
Oh oh! Tat was silly of me! Gotcha! Thanks for the info! I didn't notice it at all :p
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8441
|
|
You are welcome.
Don't worry about it. Happens to everyone
|
 |
 |
|
|
subject: Refresh JComboBox
|
|
|