Package org.jdesktop.swingx.autocomplete
Class ComboBoxAdaptor
- java.lang.Object
-
- org.jdesktop.swingx.autocomplete.AbstractAutoCompleteAdaptor
-
- org.jdesktop.swingx.autocomplete.ComboBoxAdaptor
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.util.EventListener
public class ComboBoxAdaptor extends AbstractAutoCompleteAdaptor implements java.awt.event.ActionListener
An implementation of the AbstractAutoCompleteAdaptor that is suitable for JComboBox.- Author:
- Thomas Bierhance, Karl Schaefer
-
-
Constructor Summary
Constructors Constructor Description ComboBoxAdaptor(javax.swing.JComboBox comboBox)
Creates a new ComobBoxAdaptor for the given combobox.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent actionEvent)
Implementation side effect - do not invoke.java.lang.Object
getItem(int index)
Returns the item at a given index.int
getItemCount()
Returns the number of items in the list.java.lang.Object
getSelectedItem()
Returns the currently selected item.javax.swing.text.JTextComponent
getTextComponent()
Returns the text component that is being used for the automatic completion.void
setSelectedItem(java.lang.Object item)
Sets the selected item.-
Methods inherited from class org.jdesktop.swingx.autocomplete.AbstractAutoCompleteAdaptor
getSelectedItemAsString, listContainsSelectedItem, markEntireText, markText, setSelectedItemAsString
-
-
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent actionEvent)
Implementation side effect - do not invoke.- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Parameters:
actionEvent
- -
-
getItemCount
public int getItemCount()
Description copied from class:AbstractAutoCompleteAdaptor
Returns the number of items in the list.- Specified by:
getItemCount
in classAbstractAutoCompleteAdaptor
- Returns:
- the number of items in the list
-
getItem
public java.lang.Object getItem(int index)
Description copied from class:AbstractAutoCompleteAdaptor
Returns the item at a given index. It is supposed that0<=index<getItemCount()
.- Specified by:
getItem
in classAbstractAutoCompleteAdaptor
- Parameters:
index
- the index of the item that is to be returned- Returns:
- the item at the given
index
-
setSelectedItem
public void setSelectedItem(java.lang.Object item)
Description copied from class:AbstractAutoCompleteAdaptor
Sets the selected item.- Specified by:
setSelectedItem
in classAbstractAutoCompleteAdaptor
- Parameters:
item
- the item that is to be selected
-
getSelectedItem
public java.lang.Object getSelectedItem()
Description copied from class:AbstractAutoCompleteAdaptor
Returns the currently selected item.- Specified by:
getSelectedItem
in classAbstractAutoCompleteAdaptor
- Returns:
- the selected item
-
getTextComponent
public javax.swing.text.JTextComponent getTextComponent()
Description copied from class:AbstractAutoCompleteAdaptor
Returns the text component that is being used for the automatic completion.- Specified by:
getTextComponent
in classAbstractAutoCompleteAdaptor
- Returns:
- the text component being used for the automatic completion
-
-