Interface IntelliHints

All Known Implementing Classes:
AbstractIntelliHints, AbstractListIntelliHints, FileIntelliHints, ListDataIntelliHints

public interface IntelliHints
IntelliHints is an interface that defines all necessary methods to implement showing a hint popup depending on a context and allows user to pick from a list of hints. createHintsComponent() will create a component that contains the hints. It will be shown in a popup window. After hint popup is created, updateHints(Object, boolean) will update the content of hints based on the context. Once user picks a hint from the hint popup, getSelectedHint() will be called to find the hint that user selected and call acceptHint(Object) to accept it.
  • Field Details

    • CLIENT_PROPERTY_INTELLI_HINTS

      static final String CLIENT_PROPERTY_INTELLI_HINTS
      The key of a client property. If a component has IntelliHints registered, you can use this client property to get the IntelliHints instance.
      See Also:
  • Method Details

    • createHintsComponent

      JComponent createHintsComponent()
      Creates the component which contains hints. At this moment, the content should be empty. Following call updateHints(Object, boolean) will update the content.
      Returns:
      the component which will be used to display the hints.
    • updateHints

      @Deprecated boolean updateHints(Object context)
      Deprecated.
      Update hints depending on the context. This method will be triggered for every key typed event in the text component. Subclass can override it to provide your own list of hints and call setListData to set it and returns true after that.
      Parameters:
      context - the current context
      Returns:
      true or false. If it is false, hint popup will not be shown.
    • updateHints

      boolean updateHints(Object context, boolean autoPopup)
      Update hints depending on the context. This method will be triggered for every key typed event in the text component. Subclass can override it to provide your own list of hints and call setListData to set it and returns true after that.
      Parameters:
      context - the current context
      autoPopup - true or false. If true, it means this method was called through the auto-popup feature because of the show hint timer is triggered. If false, it means user pressed the show hint key stroke to show the popup.
      Returns:
      true or false. If it is false, hint popup will not be shown.
    • getSelectedHint

      Object getSelectedHint()
      Gets the selected value. This value will be used to complete the text component.
      Returns:
      the selected value.
    • acceptHint

      void acceptHint(Object hint)
      Accepts the selected hint. Subclass can implements to decide how the new hint be set to the text component.
      Parameters:
      hint - the hint to be accepted.