javax.swing

Interface ComboBoxModel

public interface ComboBoxModel extends ListModel

The data model for a {@link 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 {@link ListDataEvent} to the model's {@link ListDataListener}s.
Method Summary
ObjectgetSelectedItem()
Returns the currently selected item in the combo box.
voidsetSelectedItem(Object item)
Sets the selected item in the combo box.

Method Detail

getSelectedItem

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

Returns: The selected item (possibly null).

setSelectedItem

public void setSelectedItem(Object item)
Sets the selected item in the combo box. Classes implementing this interface should fire a {@link ListDataEvent} to all registered {@link ListDataListener}s to indicate that the selection has changed.

Parameters: item the selected item (null permitted).