use of javax.swing.text.Highlighter.HighlightPainter in project zaproxy by zaproxy.
the class HttpPanelTextArea method highlightEntryParser.
// Parse the TextArea data and search the HighlightEntry strings
// Highlight all found strings
private void highlightEntryParser(HighlightSearchEntry entry) {
String text;
int lastPos = 0;
text = this.getText();
Highlighter hilite = this.getHighlighter();
HighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(entry.getColor());
while ((lastPos = text.indexOf(entry.getToken(), lastPos)) > -1) {
try {
hilite.addHighlight(lastPos, lastPos + entry.getToken().length(), painter);
lastPos += entry.getToken().length();
} catch (BadLocationException e) {
log.warn("Could not highlight entry", e);
}
}
}
use of javax.swing.text.Highlighter.HighlightPainter in project zaproxy by zaproxy.
the class HttpPanelTextArea method highlight.
protected void highlight(int start, int end) {
Highlighter hilite = this.getHighlighter();
HighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(DisplayUtils.getHighlightColor());
try {
removeAllHighlights();
hilite.addHighlight(start, end, painter);
this.setCaretPosition(start);
} catch (BadLocationException e) {
log.error(e.getMessage(), e);
}
}
Aggregations