Class AbstractComboBoxModel<T>

  • Type Parameters:
    T - the generic type of the Model
    All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, java.util.EventListener, javax.swing.ComboBoxModel<T>, javax.swing.ListModel<T>
    Direct Known Subclasses:
    EnumComboBoxModel, StringComboBoxModel

    public abstract class AbstractComboBoxModel<T>
    extends javax.swing.AbstractListModel<T>
    implements javax.swing.ComboBoxModel<T>, java.awt.event.ActionListener
    The abstract class AbstractComboBoxModel contains the data for a combo list and the current selected item.
    See Also:
    Serialized Form
    • Field Detail

      • comboList

        protected java.util.List<T> comboList
        The generic combo list.
      • selectedItem

        protected T selectedItem
        The the current selected item.
    • Constructor Detail

      • AbstractComboBoxModel

        public AbstractComboBoxModel()
        Instantiates a new AbstractComboBoxModel with a new list.
      • AbstractComboBoxModel

        public AbstractComboBoxModel​(java.util.List<T> comboList)
        Instantiates a new AbstractComboBoxModel from the given list.
        Parameters:
        comboList - the list
      • AbstractComboBoxModel

        public AbstractComboBoxModel​(java.util.List<T> comboList,
                                     T selectedItem)
        Instantiates a new AbstractComboBoxModel from the given arguments.
        Parameters:
        comboList - the combo list
        selectedItem - the selected item
      • AbstractComboBoxModel

        public AbstractComboBoxModel​(java.util.Set<T> set)
        Instantiates a new AbstractComboBoxModel from the given Set.
        Parameters:
        set - the combo set
      • AbstractComboBoxModel

        public AbstractComboBoxModel​(java.util.Set<T> set,
                                     T selectedItem)
        Instantiates a new AbstractComboBoxModel from the given Set.
        Parameters:
        set - the combo set
        selectedItem - the selected item
      • AbstractComboBoxModel

        public AbstractComboBoxModel​(T[] comboArray)
        Instantiates a new AbstractComboBoxModel from the given array.
        Parameters:
        comboArray - the combo array
      • AbstractComboBoxModel

        public AbstractComboBoxModel​(T[] comboArray,
                                     T selectedItem)
        Instantiates a new AbstractComboBoxModel from the given arguments.
        Parameters:
        comboArray - the combo array
        selectedItem - the selected item
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent evt)
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
      • getElementAt

        public T getElementAt​(int index)
        Specified by:
        getElementAt in interface javax.swing.ListModel<T>
      • getSize

        public int getSize()
        Specified by:
        getSize in interface javax.swing.ListModel<T>
      • setComboSet

        public void setComboSet​(java.util.Set<T> set)
        Sets the combo list from the given set.
        Parameters:
        set - the new combo set
      • setSelectedItem

        public void setSelectedItem​(java.lang.Object anItem)
        Specified by:
        setSelectedItem in interface javax.swing.ComboBoxModel<T>