I am currently developing a program that allows you to change the color of a selected text from a JEditorPane
, using setSelectedTextColor (Color.red)
, but it only temporarily changes the text when I run it with the cursor.
I would like to know how I can set it or change it, as well as the setForeground
Maybe this post can help you: Changing color of selected text in jTextPane
This use jTextPane instead of jEditorPane, which I've searched for and says that supports color changes better than jEditorPane.
If that doesn't works, please search in Google for your question and if you find it, we will appreciate you post it here. Thanks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.