Module java.desktop
Package javax.swing

Class DefaultComboBoxModel<E>

    • Constructor Detail

      • DefaultComboBoxModel

        public DefaultComboBoxModel()
        Constructs an empty DefaultComboBoxModel object.
      • DefaultComboBoxModel

        public DefaultComboBoxModel​(E[] items)
        Constructs a DefaultComboBoxModel object initialized with an array of objects.
        Parameters:
        items - an array of Object objects
      • DefaultComboBoxModel

        public DefaultComboBoxModel​(Vector<E> v)
        Constructs a DefaultComboBoxModel object initialized with a vector.
        Parameters:
        v - a Vector object ...
    • Method Detail

      • setSelectedItem

        public void setSelectedItem​(Object anObject)
        Set the value of the selected item. The selected item may be null.
        Specified by:
        setSelectedItem in interface ComboBoxModel<E>
        Parameters:
        anObject - The combo box value or null for no selection.
      • getIndexOf

        public int getIndexOf​(Object anObject)
        Returns the index-position of the specified object in the list.
        Parameters:
        anObject - the object to return the index of
        Returns:
        an int representing the index position, where 0 is the first position
      • removeAllElements

        public void removeAllElements()
        Empties the list.