public class TextPaneSearchInteraction extends Object implements SearchPanel.SearchInteraction
| Constructor and Description |
|---|
TextPaneSearchInteraction(JTextPane textComponentToSearch,
AttributeSet defaultStyle,
AttributeSet highlightStyle,
AttributeSet emphasizedHighlightStyle) |
| Modifier and Type | Method and Description |
|---|---|
int |
getCaretLocation() |
String |
getTextToSearch() |
void |
highlightAndScrollToResult(TextBlockSearchEditor editor,
TextBlockSearchEditor.SearchResult searchResult)
Highlight and then ensure this result is visible.
|
void |
highlightText(int startingIndex,
int endingIndex,
boolean ensureVisible,
boolean isEmphasized)
This highlights the text within the specified range
|
void |
removeResultHighlights()
Call this to remove the highlights of the search results.
|
void |
removeTextHighlightText(int startingIndex,
int endingIndex)
This removes the highlight from the specified existing text.
|
void |
searchComplete(TextBlockSearchEditor editor)
Notification that the search was complete and we have results to show to the user.
|
public TextPaneSearchInteraction(JTextPane textComponentToSearch, AttributeSet defaultStyle, AttributeSet highlightStyle, AttributeSet emphasizedHighlightStyle)
public void searchComplete(TextBlockSearchEditor editor)
searchComplete in interface SearchPanel.SearchInteractionpublic void removeResultHighlights()
removeResultHighlights in interface SearchPanel.SearchInteractionpublic void removeTextHighlightText(int startingIndex,
int endingIndex)
public String getTextToSearch()
getTextToSearch in interface SearchPanel.SearchInteractionpublic int getCaretLocation()
getCaretLocation in interface SearchPanel.SearchInteractionpublic void highlightAndScrollToResult(TextBlockSearchEditor editor, TextBlockSearchEditor.SearchResult searchResult)
highlightAndScrollToResult in interface SearchPanel.SearchInteractioneditor - the editor that was used to searchsearchResult - the specific result (within the editor's search results) to highlight.public void highlightText(int startingIndex,
int endingIndex,
boolean ensureVisible,
boolean isEmphasized)
startingIndex - where to start the highlightendingIndex - where to end the highlightensureVisible - true to scroll to the textisEmphasized - true to use an emphasized highlight (versus a regular highlight). Useful for showing the 'current' highlighted result.Copyright © 2013. All rights reserved