@Override @SuppressWarnings({"unchecked"}) public void setSelectedItem(Object anItem) { T i = (T) anItem; if (checker.isValueCorrect(i)) { selected = i; fireContentsChanged(this, -1, -1); } }
@SuppressWarnings({"unchecked"}) public ComboBoxEditorModel(IValueChecker<T> checker, T selected) { this.checker = checker; if (selected != null && checker.isValueCorrect(selected)) { this.selected = selected; } else { // Automatically select the first component this.selected = getElementAt(0); } }
@Override public T getElementAt(int index) { return checker.getPossibleValues().get(index); }
@Override public int getSize() { return checker.getPossibleValues().size(); }