public interface IFindService
IMozillaBrowserCanvas that exposes the
browser's advanced text-finding functionality.| Modifier and Type | Method and Description |
|---|---|
void |
cancelAllSearches()
Cancels all searches that are currently in progress.
|
void |
clearAllMatches()
Clears all previously-found matches.
|
void |
findAndHighlight(String text,
Color color)
Searches through the current document for instances of the given string,
and highlights those matches with the given color.
|
void |
findAndHighlight(String text,
Color color,
FindFlag[] flags)
Searches through the current document for instances of the given string,
and highlights those matches with the given color.
|
void |
nextMatch()
Selects the next match after the current selection, and scrolls it into
view if necessary.
|
void |
previousMatch()
Selects the previous match before the current selection, and scrolls it
into view if necessary.
|
void findAndHighlight(String text, Color color)
This method always performs case-sensitive matching. For case-insensitive
matching, pass the appropriate flag to
findAndHighlight(String, Color, FindFlag[]).
text - string to search forcolor - color used to highlight matchesfindAndHighlight(String, Color, FindFlag[])void findAndHighlight(String text, Color color, FindFlag[] flags)
Searching is case-sensitive by default. The following calls are all equivalent, and will perform a case-sensitive search:
findService.findAndHighlight("needle", Color.RED, null);
findService.findAndHighlight("needle", Color.RED, new FindFlag[0]);
findService.findAndHighlight("needle", Color.RED, new FindFlag[] {});
To perform a case-insensitive search, pass
FindFlag.IGNORE_CASE as a flag. For example, the following call
will find treasure, Treasure,
TREASURE, and other variations:
FindFlag[] flags = { FindFlag.IGNORE_CASE };
findService.findAndHighlight("treasure", Color.YELLOW, flags);
text - string to search forcolor - color used to highlight matchesflags - array of flags used to customize the search process, or
null to specify no flagsFindFlag.IGNORE_CASE,
findAndHighlight(String, Color)void cancelAllSearches()
findAndHighlight(String, Color, FindFlag[]) is taking too long.
Any matches that have already been found will still be highlighted.
void clearAllMatches()
nextMatch() and previousMatch() will
no longer navigate between them.void nextMatch()
previousMatch()void previousMatch()
nextMatch()