Class AutoCompleteDocument

java.lang.Object
org.jdesktop.swingx.autocomplete.AutoCompleteDocument
All Implemented Interfaces:
Document
Direct Known Subclasses:
AutoCompleteStyledDocument

public class AutoCompleteDocument extends Object implements Document
A document that can be plugged into any JTextComponent to enable automatic completion. It finds and selects matching items using any implementation of the AbstractAutoCompleteAdaptor.
  • Field Details

    • strictMatching

      protected boolean strictMatching
      true, if only items from the adaptors's list can be entered false, otherwise (selected item might not be in the adaptors's list)
    • delegate

      protected final Document delegate
    • selecting

      boolean selecting
      Flag to indicate if adaptor.setSelectedItem has been called. Subsequent calls to remove/insertString should be ignored as they are likely have been caused by the adapted Component that is trying to set the text for the selected component.
    • adaptor

      The adaptor that is used to find and select items.
    • stringConverter

      ObjectToStringConverter stringConverter
    • handler

      private final AutoCompleteDocument.Handler handler
    • EQUALS_IGNORE_CASE

      private static final Comparator<String> EQUALS_IGNORE_CASE
    • STARTS_WITH_IGNORE_CASE

      private static final Comparator<String> STARTS_WITH_IGNORE_CASE
    • EQUALS

      private static final Comparator<String> EQUALS
    • STARTS_WITH

      private static final Comparator<String> STARTS_WITH
  • Constructor Details

    • AutoCompleteDocument

      public AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean strictMatching, ObjectToStringConverter stringConverter, Document delegate)
      Creates a new AutoCompleteDocument for the given AbstractAutoCompleteAdaptor.
      Parameters:
      adaptor - The adaptor that will be used to find and select matching items.
      strictMatching - true, if only items from the adaptor's list should be allowed to be entered
      stringConverter - the converter used to transform items to strings
      delegate - the Document delegate backing this document
    • AutoCompleteDocument

      public AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean strictMatching, ObjectToStringConverter stringConverter)
      Creates a new AutoCompleteDocument for the given AbstractAutoCompleteAdaptor.
      Parameters:
      adaptor - The adaptor that will be used to find and select matching items.
      strictMatching - true, if only items from the adaptor's list should be allowed to be entered
      stringConverter - the converter used to transform items to strings
    • AutoCompleteDocument

      public AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean strictMatching)
      Creates a new AutoCompleteDocument for the given AbstractAutoCompleteAdaptor.
      Parameters:
      adaptor - The adaptor that will be used to find and select matching items.
      strictMatching - true, if only items from the adaptor's list should be allowed to be entered
  • Method Details