How can I set partial text color in JTextArea?

后端 未结 2 1148
挽巷
挽巷 2021-01-22 05:04

I want to set color for specific lines in the text area. What I\'ve found so far, is the following

// Declarations
private final DefaultStyledDocument document;         


        
2条回答
  •  孤城傲影
    2021-01-22 05:36

    Create a custom swing document extending for example PlainDocument and have a custom HighlightedView which is responsible for painting tokens.

提交回复
热议问题