Adding vectors to empty JcomboBox
I am working on a program that integrates with mysql.
I am querying the database and using a vector to populate a JcomboBox with the results . This is done as the GUI gets built and is working fine. Based on the item chosen in the first JcomboBox I开发者_如何学Python want to popultate the second JcomboBox. I am using an action listener on the first JcomboBox, calling another class, passing the item selected in the first box, doing the query and returning the result as a vector.
As I used a vector in the first case I thought I could just call
box2.addItem(vector2);
My problem is that I get the result of the query as one entry enclosed by []
I am puzzled because
JComboBox Box1 = new JComboBox(vector1);
works to set up a JcomboBox at intitialisation but I cannot add a vector to an empty box after it has been made visible.
I can input single lines using box2.addItem("new line etc"); but I want to add a vector line in box 1.
Could someone give me a hint as to what I am doing wrong?
Sorry that should be add the vector result to box 2.
The result contains about 9 values but are all added as one line in box 2.
I need the resulting vector to give me the 9 or so values in separate lines.
Thanks guys!
精彩评论