Java Utililty Methods JComboBox Model

List of utility methods to do JComboBox Model

Description

The list of methods to do JComboBox Model are organized into topic(s).

Method

ListmodelToList(DefaultComboBoxModel model)
model To List
List<String> elements = new ArrayList<String>();
for (int i = 0; i < model.getSize(); i++) {
    elements.add((String) model.getElementAt(i));
return elements;
voidupdateComboBoxModel(ComboBoxModel model, List values)
update Combo Box Model
DefaultComboBoxModel dcbm = (DefaultComboBoxModel) model;
Object selected = dcbm.getSelectedItem();
dcbm.removeAllElements();
for (Object e : values) {
    dcbm.addElement(e);
    if (e.equals(selected)) {
        dcbm.setSelectedItem(e);
voidupdateComboBoxModel(final JComboBox aComboBox, final Vector aValues)
update Combo Box Model
aComboBox.setModel(new DefaultComboBoxModel(aValues));