Combo Box Won't Update

I can't get my combo box to change it's list. It always displays the original list. I know that this code is being executed, cause I verified it with the debugger. I can't understand this.

String[] stringArray ={"Why","Can't","I","Change","You"};

cboMessageHeader =new javax.swing.JComboBox();

cboMessageHeader.setModel(new javax.swing.DefaultComboBoxModel(stringArray));

I've also tried

cboMessageHeader =new javax.swing.JComboBox(stringArray );

And

cboMessageHeader =new JComboBox(new EnumComboBoxModel(CANHeader.class));

Which is what I really want to do (use the enum to create the list).

Ahh yes and thanks to anyone who responds to this, i'm pretty frustrated at the moment and help is appreciated,

Nathan

[1133 byte] By [Nathan_ValidMana] at [2007-10-3 10:28:45]
# 1
More info needed?I'm using NetBeans which shouldn't be a problem. The form editor has already initialized the combo box. Immediately after this I call my own function to re-initialize this combo box. It there some sort of reload method I need to call, I don't see one.
Nathan_ValidMana at 2007-7-15 5:51:17 > top of Java-index,Java Essentials,New To Java...
# 2

if the original comboBox is called cboMessageHeader, then this line is your problem

cboMessageHeader = new javax.swing.JComboBox();

remove the line, then this line should change the contents OK

cboMessageHeader.setModel(new ....

Michael_Dunna at 2007-7-15 5:51:17 > top of Java-index,Java Essentials,New To Java...
# 3
That's it, that you very much, you saved me from some serious head trama, haha. Could someone tell me exactly why you can't assign cboMessageHeader = new ... twice?
Nathan_ValidMana at 2007-7-15 5:51:17 > top of Java-index,Java Essentials,New To Java...
# 4

> Could someone tell me exactly why you can't assign

> cboMessageHeader = new ...

> twice?

you can, but the second one is a new instance of JComboBox, and not the one

you see on the screen.

to get it to work with the new comboBox, you would have to remove the old one,

then add back the new one, revalidate the panel, perhaps repaint - overall, messy.

much easier to just change the combobox's model

Michael_Dunna at 2007-7-15 5:51:17 > top of Java-index,Java Essentials,New To Java...