Text color not changing

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?
7 Replies
JavaBot
JavaBot5mo ago
This post has been reserved for your question.
Hey @blockgoblin31! 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.
blockgoblin31
blockgoblin31OP5mo ago
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
JavaBot
JavaBot5mo ago
💤 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.
blockgoblin31
blockgoblin31OP5mo ago
Bump
JavaBot
JavaBot5mo ago
💤 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.
blockgoblin31
blockgoblin31OP5mo ago
bump 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
JavaBot
JavaBot5mo ago
Post Closed
This post has been closed by <@501514065068294154>.
Want results from more Discord servers?
Add your server