Class SearchHighlighter

java.lang.Object
is.codion.swing.common.ui.component.text.SearchHighlighter

public final class SearchHighlighter extends Object
Highlights search results in a JTextComponent.

Instantiate via builder(JTextComponent).

  • Method Details

    • searchString

      public Value<String> searchString()
      Returns:
      the search string value
    • caseSensitive

      public State caseSensitive()
      Returns:
      the State controlling whether the search is case-sensitive.
    • highlightColor

      public void highlightColor(Color color)
      Parameters:
      color - the color to use when highlighting search results.
    • selectedHighlightColor

      public void selectedHighlightColor(Color color)
      Parameters:
      color - the color to use when highlighting the selected search result.
    • createSearchField

      public JTextField createSearchField()
      Returns:
      a text field for entering the search text.
    • builder

      public static SearchHighlighter.Builder builder(JTextComponent textComponent)
      Parameters:
      textComponent - the text component
      Returns:
      a new SearchHighlighter.Builder instance
    • nextSearchPosition

      public void nextSearchPosition()
      Moves to the next search position, if available, with wrap-around.
    • previousSearchPosition

      public void previousSearchPosition()
      Moves to the previous search position, if available, with wrap-around.