Hightlighting selected text with rows in Java(Swing) -
how can highlights(highlighter) in swing(jtextpane) not text(with rows) when select 2 , more rows. need highlight selection in intellij idea.
swingutilities.invokelater(new runnable() { jtextpane textpane = new jtextpane(); jscrollpane textpanewithscroll = new jscrollpane(textpane); this.getcontentpane().add(textpanewithscroll); this.setvisible(true); });
screenshot
i'm guessing want highlight extend right side of text pane.
if can use:
defaulthighlighter highlighter = (defaulthighlighter)textpane.gethighlighter(); highlighter.setdrawslayeredhighlights(false);
when add together highlight text pane offset must 1 greater lastly character on line newline character included in highlight.
java swing highlight
No comments:
Post a Comment