javax.swing
Interface ComboBoxModel

All Superinterfaces:
ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel
All Known Subinterfaces:
MutableComboBoxModel sample code for javax.swing.MutableComboBoxModel definition code for javax.swing.MutableComboBoxModel
All Known Implementing Classes:
DefaultComboBoxModel sample code for javax.swing.DefaultComboBoxModel definition code for javax.swing.DefaultComboBoxModel , MetalFileChooserUI.DirectoryComboBoxModel sample code for javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxModel definition code for javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxModel , MetalFileChooserUI.FilterComboBoxModel sample code for javax.swing.plaf.metal.MetalFileChooserUI.FilterComboBoxModel definition code for javax.swing.plaf.metal.MetalFileChooserUI.FilterComboBoxModel

public interface ComboBoxModel
extends ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel

A data model for a combo box. This interface extends ListDataModel and adds the concept of a selected item. The selected item is generally the item which is visible in the combo box display area.

The selected item may not necessarily be managed by the underlying ListModel. This disjoint behavior allows for the temporary storage and retrieval of a selected item in the model.


Method Summary
 Object sample code for java.lang.Object definition code for java.lang.Object getSelectedItem sample code for javax.swing.ComboBoxModel.getSelectedItem() definition code for javax.swing.ComboBoxModel.getSelectedItem() ()
          Returns the selected item
 void setSelectedItem sample code for javax.swing.ComboBoxModel.setSelectedItem(java.lang.Object) definition code for javax.swing.ComboBoxModel.setSelectedItem(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  anItem)
          Set the selected item.
 
Methods inherited from interface javax.swing.ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel
addListDataListener sample code for javax.swing.ListModel.addListDataListener(javax.swing.event.ListDataListener) definition code for javax.swing.ListModel.addListDataListener(javax.swing.event.ListDataListener) , getElementAt sample code for javax.swing.ListModel.getElementAt(int) definition code for javax.swing.ListModel.getElementAt(int) , getSize sample code for javax.swing.ListModel.getSize() definition code for javax.swing.ListModel.getSize() , removeListDataListener sample code for javax.swing.ListModel.removeListDataListener(javax.swing.event.ListDataListener) definition code for javax.swing.ListModel.removeListDataListener(javax.swing.event.ListDataListener)
 

Method Detail

setSelectedItem sample code for javax.swing.ComboBoxModel.setSelectedItem(java.lang.Object) definition code for javax.swing.ComboBoxModel.setSelectedItem(java.lang.Object)

void setSelectedItem(Object sample code for java.lang.Object definition code for java.lang.Object  anItem)
Set the selected item. The implementation of this method should notify all registered ListDataListeners that the contents have changed.

Parameters:
anItem - the list object to select or null to clear the selection

getSelectedItem sample code for javax.swing.ComboBoxModel.getSelectedItem() definition code for javax.swing.ComboBoxModel.getSelectedItem()

Object sample code for java.lang.Object definition code for java.lang.Object  getSelectedItem()
Returns the selected item

Returns:
The selected item or null if there is no selection