Class ListAdaptor

  • All Implemented Interfaces:
    java.util.EventListener, javax.swing.event.ListSelectionListener

    public class ListAdaptor
    extends AbstractAutoCompleteAdaptor
    implements javax.swing.event.ListSelectionListener
    An implementation of the AbstractAutoCompleteAdaptor that is suitable for a JList in conjunction with a JTextComponent.
    Author:
    Thomas Bierhance
    • 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
      • ListAdaptor

        public ListAdaptor​(javax.swing.JList list,
                           javax.swing.text.JTextComponent textComponent,
                           ObjectToStringConverter stringConverter)
        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
        stringConverter - the converter used to transform items to strings
    • 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 - -
      • getItem

        public java.lang.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
      • 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 class AbstractAutoCompleteAdaptor
        Returns:
        the text component being used for the automatic completion