org.jdesktop.swingx.autocomplete
Class ComboBoxAdaptor

java.lang.Object
  extended by org.jdesktop.swingx.autocomplete.AbstractAutoCompleteAdaptor
      extended by org.jdesktop.swingx.autocomplete.ComboBoxAdaptor
All Implemented Interfaces:
ActionListener, EventListener

public class ComboBoxAdaptor
extends AbstractAutoCompleteAdaptor
implements ActionListener

An implementation of the AbstractAutoCompleteAdaptor that is suitable for JComboBox.


Constructor Summary
ComboBoxAdaptor(JComboBox comboBox)
          Creates a new ComobBoxAdaptor for the given combobox.
 
Method Summary
 void actionPerformed(ActionEvent actionEvent)
          Implementation side effect - do not invoke.
 Object getItem(int index)
          Returns the item at a given index.
 int getItemCount()
          Returns the number of items in the list.
 Object getSelectedItem()
          Returns the currently selected item.
 JTextComponent getTextComponent()
          Returns the text component that is being used for the automatic completion.
 void setSelectedItem(Object item)
          Sets the selected item.
 
Methods inherited from class org.jdesktop.swingx.autocomplete.AbstractAutoCompleteAdaptor
getSelectedItemAsString, listContainsSelectedItem, markEntireText, markText, setSelectedItemAsString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComboBoxAdaptor

public ComboBoxAdaptor(JComboBox comboBox)
Creates a new ComobBoxAdaptor for the given combobox.

Parameters:
comboBox - the combobox that should be adapted
Method Detail

actionPerformed

public void actionPerformed(ActionEvent actionEvent)
Implementation side effect - do not invoke.

Specified by:
actionPerformed in interface ActionListener
Parameters:
actionEvent - -

getItemCount

public int getItemCount()
Description copied from class: AbstractAutoCompleteAdaptor
Returns the number of items in the list.

Specified by:
getItemCount in class AbstractAutoCompleteAdaptor
Returns:
the number of items in the list

getItem

public Object getItem(int index)
Description copied from class: AbstractAutoCompleteAdaptor
Returns the item at a given index. It is supposed that 0<=index<getItemCount().

Specified by:
getItem in class AbstractAutoCompleteAdaptor
Parameters:
index - the index of the item that is to be returned
Returns:
the item at the given index

setSelectedItem

public void setSelectedItem(Object item)
Description copied from class: AbstractAutoCompleteAdaptor
Sets the selected item.

Specified by:
setSelectedItem in class AbstractAutoCompleteAdaptor
Parameters:
item - the item that is to be selected

getSelectedItem

public Object getSelectedItem()
Description copied from class: AbstractAutoCompleteAdaptor
Returns the currently selected item.

Specified by:
getSelectedItem in class AbstractAutoCompleteAdaptor
Returns:
the selected item

getTextComponent

public JTextComponent getTextComponent()
Description copied from class: AbstractAutoCompleteAdaptor
Returns the text component that is being used for the automatic completion.

Specified by:
getTextComponent in class AbstractAutoCompleteAdaptor
Returns:
the text component being used for the automatic completion