cdc.bench.support.ui.swing.EnumComboBoxModel Maven / Gradle / Ivy
package cdc.bench.support.ui.swing;
import javax.swing.DefaultComboBoxModel;
public class EnumComboBoxModel> extends DefaultComboBoxModel {
private static final long serialVersionUID = 1L;
private final Class enumClass;
public EnumComboBoxModel(Class enumClass) {
this.enumClass = enumClass;
for (final E value : enumClass.getEnumConstants()) {
addElement(value);
}
}
public Class getEnumClass() {
return enumClass;
}
public void setSelectedItem(E value) {
super.setSelectedItem(value);
}
@Override
public E getSelectedItem() {
return enumClass.cast(super.getSelectedItem());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy