org.jdesktop.swingx.autocomplete
Class ListAdaptor

java.lang.Object
  extended by org.jdesktop.swingx.autocomplete.AbstractComponentAdaptor
      extended by org.jdesktop.swingx.autocomplete.ListAdaptor
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ListSelectionListener

public class ListAdaptor
extends AbstractComponentAdaptor
implements javax.swing.event.ListSelectionListener

An implementation of the AbstractComponentAdaptor that is suitable for a JList in conjunction with a JTextComponent.


Constructor Summary
ListAdaptor(javax.swing.JList list, javax.swing.text.JTextComponent textComponent)
          Creates a new JListAdaptor for the given list and text component.
 
Method Summary
 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.
 void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent)
          Implementation side effect - do not invoke.
 
Methods inherited from class org.jdesktop.swingx.autocomplete.AbstractComponentAdaptor
listContainsSelectedItem, markEntireText, markText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListAdaptor

public ListAdaptor(javax.swing.JList list,
                   javax.swing.text.JTextComponent textComponent)
Creates a new JListAdaptor for the given list and text component.

Parameters:
list - the list that contains the items that are used for automatic completion
textComponent - the text component that will be used automatic completion
Method Detail

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent)
Implementation side effect - do not invoke.

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener
Parameters:
listSelectionEvent - -

getSelectedItem

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

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

getItemCount

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

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

getItem

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

Specified by:
getItem in class AbstractComponentAdaptor
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: AbstractComponentAdaptor
Sets the selected item.

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

getTextComponent

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

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