I want to add an array to an existing combobox without passing the array object as a argument in the constructor. Is there perhaps a way to do this by using a method?
Something like the following
Object[] comboBoxDisplay = myAnimals.toArray();
comboAnimals.add(comboBoxDisplay);
Use a DefaultComboBoxModel to construct the JComboBox it provides an addElement() method.
You'd have to call that from a loop, rather than as a single statement, but then, that's why they pay us 'the big bucks'. ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With