posted 21 years ago
I think what you are seeing is an example of what I talked about in my first reply. If you look at the code in the "actionEvent" method:
The first line, "JComboBox mainCombo = new JComboBox()" creates an instance of a JComboBox and assigns it to "mainCombo". Two lines later, "mainCombo = getdata(mainrs)" will create a second instance of a JComboBox and assign that to "mainCombo".
The second instance (created by the call to "getdata(...)" is the instance that contains the data. The first instance, no longer explicitly referenced in the code, may still be around (if there is a reference to it), but it contains no data.
So the question becomes, which instance of "JComboBox" that you created is in the UI? In fact, if the three lines of code [cited above] are in a method, then the "mainCombo" instance variable will be local only to that method and whatever appears in the UI will be another--a third--instance of "JComboBox".
If it's not too much trouble, provide the full code [at least in terms of the instance variables, UI building, local methods] and it should be easy to spot the errant code.