List of utility methods to do JComboBox Model
List | modelToList(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; |
void | updateComboBoxModel(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); |
void | updateComboBoxModel(final JComboBox aComboBox, final Vector update Combo Box Model aComboBox.setModel(new DefaultComboBoxModel(aValues));
|