javax.swing
Interface ComboBoxModel

All Superinterfaces:
ListModel
All Known Subinterfaces:
MutableComboBoxModel
All Known Implementing Classes:
DefaultComboBoxModel, MetalFileChooserUI.DirectoryComboBoxModel, MetalFileChooserUI.FilterComboBoxModel

public interface ComboBoxModel
extends ListModel

The data model for a JComboBox. This model keeps track of elements contained in the JComboBox as well as the current combo box selection. Whenever the selection in the JComboBox changes, the ComboBoxModel should fire a ListDataEvent to the model's ListDataListeners.


Method Summary
 Object getSelectedItem()
          Returns the currently selected item in the combo box.
 void setSelectedItem(Object item)
          Sets the selected item in the combo box.
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
 

Method Detail

setSelectedItem

void setSelectedItem(Object item)
Sets the selected item in the combo box. Classes implementing this interface should fire a ListDataEvent to all registered ListDataListeners to indicate that the selection has changed.

Parameters:
item - the selected item (null permitted).

getSelectedItem

Object getSelectedItem()
Returns the currently selected item in the combo box.

Returns:
The selected item (possibly null).