org.jdesktop.swingx.combobox
Class ListComboBoxModel

java.lang.Object
  extended by org.jdesktop.swingx.combobox.ListComboBoxModel
All Implemented Interfaces:
ActionListener, EventListener, ComboBoxModel, ListModel
Direct Known Subclasses:
MapComboBoxModel

public class ListComboBoxModel
extends Object
implements ComboBoxModel, ActionListener


Field Summary
protected  List data
           
protected  List listeners
           
protected  Object selected
           
 
Constructor Summary
ListComboBoxModel(List list)
           
 
Method Summary
 void actionPerformed(ActionEvent evt)
          Invoked when an action occurs.
 void addListDataListener(ListDataListener l)
          Adds a listener to the list that's notified each time a change to the data model occurs.
 void fireUpdate()
           
 Object getElementAt(int index)
          Returns the value at the specified index.
 Object getSelectedItem()
          Returns the selected item
 int getSize()
          Returns the length of the list.
 void removeListDataListener(ListDataListener l)
          Removes a listener from the list that's notified each time a change to the data model occurs.
 void setSelectedItem(Object item)
          Set the selected item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

protected List data

selected

protected Object selected

listeners

protected List listeners
Constructor Detail

ListComboBoxModel

public ListComboBoxModel(List list)
Method Detail

setSelectedItem

public void setSelectedItem(Object item)
Description copied from interface: javax.swing.ComboBoxModel
Set the selected item. The implementation of this method should notify all registered ListDataListeners that the contents have changed.

Specified by:
setSelectedItem in interface ComboBoxModel
Parameters:
item - the list object to select or null to clear the selection

getSelectedItem

public Object getSelectedItem()
Description copied from interface: javax.swing.ComboBoxModel
Returns the selected item

Specified by:
getSelectedItem in interface ComboBoxModel
Returns:
The selected item or null if there is no selection

getElementAt

public Object getElementAt(int index)
Description copied from interface: javax.swing.ListModel
Returns the value at the specified index.

Specified by:
getElementAt in interface ListModel
Parameters:
index - the requested index
Returns:
the value at index

getSize

public int getSize()
Description copied from interface: javax.swing.ListModel
Returns the length of the list.

Specified by:
getSize in interface ListModel
Returns:
the length of the list

addListDataListener

public void addListDataListener(ListDataListener l)
Description copied from interface: javax.swing.ListModel
Adds a listener to the list that's notified each time a change to the data model occurs.

Specified by:
addListDataListener in interface ListModel
Parameters:
l - the ListDataListener to be added

removeListDataListener

public void removeListDataListener(ListDataListener l)
Description copied from interface: javax.swing.ListModel
Removes a listener from the list that's notified each time a change to the data model occurs.

Specified by:
removeListDataListener in interface ListModel
Parameters:
l - the ListDataListener to be removed

actionPerformed

public void actionPerformed(ActionEvent evt)
Description copied from interface: java.awt.event.ActionListener
Invoked when an action occurs.

Specified by:
actionPerformed in interface ActionListener

fireUpdate

public void fireUpdate()