< prev index next >

## src/java.desktop/share/classes/javax/swing/ComboBoxModel.java

Print this page

    rev 48358 : Work in progress for JDK-6303622
    Use generic in Swing components like JComboBox
    1. Added generic return type and parameter type for JComboBox.
    2. Modified JList related classes as well.

      28  * A data model for a combo box. This interface extends <code>ListDataModel</code>
      29  * and adds the concept of a <i>selected item</i>. The selected item is generally
      30  * the item which is visible in the combo box display area.
      31  * <p>
      32  * The selected item may not necessarily be managed by the underlying
      33  * <code>ListModel</code>. This disjoint behavior allows for the temporary
      34  * storage and retrieval of a selected item in the model.
      35  *
      36  * @param <E> the type of the elements of this model
      37  *
      38  * @author Arnaud Weber
      39  * @since 1.2
      40  */
      41 public interface ComboBoxModel<E> extends ListModel<E> {
      42
      43   /**
      44    * Set the selected item. The implementation of this  method should notify
      45    * all registered <code>ListDataListener</code>s that the contents
      46    * have changed.
      47    *

      48    * @param anItem the list object to select or <code>null</code>
      49    *        to clear the selection
      50    */
      51   void setSelectedItem(Object anItem);
      52
      53   /**
      54    * Returns the selected item
      55    * @return The selected item or <code>null</code> if there is no selection
      56    */
      57   Object getSelectedItem();
      58 }
      28  * A data model for a combo box. This interface extends <code>ListDataModel</code>
      29  * and adds the concept of a <i>selected item</i>. The selected item is generally
      30  * the item which is visible in the combo box display area.
      31  * <p>
      32  * The selected item may not necessarily be managed by the underlying
      33  * <code>ListModel</code>. This disjoint behavior allows for the temporary
      34  * storage and retrieval of a selected item in the model.
      35  *
      36  * @param <E> the type of the elements of this model
      37  *
      38  * @author Arnaud Weber
      39  * @since 1.2
      40  */
      41 public interface ComboBoxModel<E> extends ListModel<E> {
      42
      43   /**
      44    * Set the selected item. The implementation of this  method should notify
      45    * all registered <code>ListDataListener</code>s that the contents
      46    * have changed.
      47    *
      48    * @param <E> the type of the elements of this model.
      49    * @param anItem the list object to select or <code>null</code>
      50    *        to clear the selection
      51    */
      52   void setSelectedItem(E anItem);
      53
      54   /**
      55    * Returns the selected item
      56    * @return The selected item or <code>null</code> if there is no selection
      57    */
      58   E getSelectedItem();
      59 }

< prev index next >