Dynamically updating combo boxes

I have a combo box that is initialized to names. As my application runs, I can add and delete new records to an array of Objects. When I delete I really just want to add an asterisk to the end of the name (to indicate deleted) and change the entry in the combo box from name to name*. How do you change the value of a combo box entry at a specific index?

[361 byte] By [irarudowskya] at [2007-9-29 17:00:05]
# 1
From the API....void setSelectedItem(Object anObject) Sets the selected item in the combo box display area to the object in the argument.
zneroladivada at 2007-7-15 15:35:23 > top of Java-index,Archived Forums,Java Programming...
# 2
Sorry thats in ComboBoxModel. You get the model and then you can alter the models elemenst which should change the values you seed in the JComboBox.
zneroladivada at 2007-7-15 15:35:23 > top of Java-index,Archived Forums,Java Programming...
# 3
Check out javax.swing Class DefaultComboBoxModel
zneroladivada at 2007-7-15 15:35:23 > top of Java-index,Archived Forums,Java Programming...
# 4

I'm not trying to update the name that displays in the combo box, I'm trying to change one of the entries in the combo box to a different value but still keep all the other entries the same.

Before delete

Sam

Jane

Phil

Alan

After delete Phil

Sam

Jane

Phil*

Alan

irarudowskya at 2007-7-15 15:35:23 > top of Java-index,Archived Forums,Java Programming...
# 5

I have resolved the issue.

I remove all items from the combo box but first remove the item listener so that nothing is triggered during the removal of items. Then I can add items to the combo box from scratch. When that's done I add the item listener back to the combox box and thinsg are back to normal.

irarudowskya at 2007-7-15 15:35:23 > top of Java-index,Archived Forums,Java Programming...