#Text color not changing

14 messages · Page 1 of 1 (latest)

kind pine
#

I have a custom class that extends JTextArea, I'm eventually going to use it to copy information between two different views but figured I might as well implement a quick dark mode. The problem is my new AttributeSet isn't applied, and I can't tell why. I've used StyledDocument.insertString() before for setting text and background color(working with a JTextPane then), but here it doesnt seem to work the same way. Do I need to extend a different class?

lethal rapidsBOT
#

This post has been reserved for your question.

Hey @kind pine! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

kind pine
#

or is there something else that stops JTextArea from displaying colors

#

its definitely not me extending the wrong class, JTextPane uses a DefaultStyledDocument too

#

and JTextPane calls the same insertString method

#

so I'm now even more confused

lethal rapidsBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

kind pine
#

Bump

lethal rapidsBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

kind pine
#

bump

kind pine
#

so setBackground() and setForeground() work but not if I call them in the constructor? Why would that be?

#

(maybe its because im using the wrong constructor lol)

#

anyway figured out a solution