0

Sorry if I'm not wording this correctly, but how can I change the text color of future texts in a JTextPane? For example, if the current text is "Hi I'm" and I update the text color, then only the text following after "Hi I'm" will change its color.

Right now I am able to change the all the of the current text color using setForeground(color). So if I type anything after "Hi I'm", then both the current and future text color will change, which is not what I want to happen.

Also, when I try changing the text color of a highlighted text, using setSelectedTextColor(color) it does not change it permanently. If the text is highlighted, and I try to change the color, the color will change, but as soon as I unhighlight it, the text color goes back to the default black.

bob dylan
  • 647
  • 1
  • 10
  • 25

0 Answers0