Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Different fonts in JTextPane

939485May 24 2012 — edited May 25 2012
Hello 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 22 2012
Added on May 24 2012
3 comments
637 views