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
DefaultComboBoxModelto construct theJComboBoxit provides anaddElement()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’. 😉