Class EnumComboBoxModel<E extends java.lang.Enum<E>>
- java.lang.Object
-
- javax.swing.AbstractListModel<T>
-
- de.alpharogroup.swing.combobox.model.AbstractComboBoxModel<E>
-
- de.alpharogroup.swing.combobox.model.EnumComboBoxModel<E>
-
- Type Parameters:
E- the generic type of the enum
- All Implemented Interfaces:
java.awt.event.ActionListener,java.io.Serializable,java.util.EventListener,javax.swing.ComboBoxModel<E>,javax.swing.ListModel<E>
public class EnumComboBoxModel<E extends java.lang.Enum<E>> extends AbstractComboBoxModel<E>
The classEnumComboBoxModelis an implementation that safely wraps anEnum.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class de.alpharogroup.swing.combobox.model.AbstractComboBoxModel
comboList, selectedItem
-
-
Constructor Summary
Constructors Constructor Description EnumComboBoxModel(@NonNull java.lang.Class<E> enumClass)Instantiates a newEnumComboBoxModelfrom the given enum class.EnumComboBoxModel(java.lang.Class<E> enumClass, E selectedItem)Instantiates a newEnumComboBoxModelfrom the given enum class and set as selected item the given value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetSelectedItem(java.lang.Object anItem)-
Methods inherited from class de.alpharogroup.swing.combobox.model.AbstractComboBoxModel
actionPerformed, getElementAt, getSize, setComboSet
-
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
-
-
-
Constructor Detail
-
EnumComboBoxModel
public EnumComboBoxModel(@NonNull @NonNull java.lang.Class<E> enumClass)Instantiates a newEnumComboBoxModelfrom the given enum class.- Parameters:
enumClass- the enum class
-
EnumComboBoxModel
public EnumComboBoxModel(java.lang.Class<E> enumClass, E selectedItem)
Instantiates a newEnumComboBoxModelfrom the given enum class and set as selected item the given value.- Parameters:
enumClass- the enum classselectedItem- the selected item
-
-
Method Detail
-
setSelectedItem
public void setSelectedItem(java.lang.Object anItem)
- Specified by:
setSelectedItemin interfacejavax.swing.ComboBoxModel<E extends java.lang.Enum<E>>- Overrides:
setSelectedItemin classAbstractComboBoxModel<E extends java.lang.Enum<E>>
-
-