Different fonts in JTextPane
939485May 24 2012 — edited May 25 2012Hello everyone.
I need to analize some text in a JTextPane and change the font color of some part of the text.
For example, if the JTextPane has this String:
test()
I need to change the font of "test" into blue color.
I know how to do it if I know what will be written, but I need to let the user write some text and after change the font.
I figured out how to detect the new-written text and how to get his position, but I don't know how to change the color of the font.
Someone knows which class/method I have to use?
Edited by: 936482 on 24/05/2012 04:00