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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -