Nuwan
Nuwan

Reputation: 360

setting multiple highlighters to a jeditorpane

I want to know whether we can set two highlighters to a JEditorpane using sethighlighter(new Highlighter()) method where one is a default highlighter and the other is a underline highlighter.

Upvotes: 1

Views: 298

Answers (2)

camickr
camickr

Reputation: 324157

Rectangle Painter shows an example of creating a custom HighlightPainter. You should be able to modify it to just do an underline.

Upvotes: 2

StanislavL
StanislavL

Reputation: 57421

You can use one highlighter but adding highlights with another HighlightPainter to paint your underline.

public Object addHighlight(int p0, int p1, HighlightPainter p) throws BadLocationException;

Upvotes: 1

Related Questions