private void selectScope(String preselect) { if (preselect != null) { final JComboBox combo = getComboBox(); DefaultComboBoxModel model = (DefaultComboBoxModel) combo.getModel(); for (int i = 0; i < model.getSize(); i++) { ScopeDescriptor descriptor = (ScopeDescriptor) model.getElementAt(i); if (preselect.equals(descriptor.getDisplay())) { combo.setSelectedIndex(i); break; } } } }
@Override public void customize( JList list, ScopeDescriptor value, int index, boolean selected, boolean hasFocus) { setText(value.getDisplay()); if (value instanceof ScopeSeparator) { setSeparator(); } }