java - Get paragraph style in JTextPane -
i'm doing text editor using jtextpane, need add colors words want if user clicks on area colored, painted color (paragraph style), not logical style. looking getparagraphattributes wasn't able paragraph style property.
how paragraph style in jtextpane?
private style getcolor(string token) { if (token.equals("while")) return editor.getstyle("blue"); return editor.getlogicalstyle(); //at point want current not logical if it's possible. }
try use
((styleddocument)textpane.getdocument()).getparagraphelement(position).getattributes();
Comments
Post a Comment