Java colored character GUI

I'm making a GUI dictionary program and need to highlight letters in each displayed word I want to know how to do this. It's not very difficult to color my whole jtextarea, but it seems a little difficult to color only some characters I've read about jtextpane. I can use style fonts, but even that's not easy I need to parse the characters of each dictionary word and change the character color

Solution

Yes, you want to use jeditorpane or jtextpane to do this You can use styles, as you can see, or you can create content as HTML and display it. If it is not flexible, it will be easier

The relevant parts of java tutorial are from here start

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>