How do I append text to a JTextPane?
I've only used JTextAreas in the past, but my current project needs colored text, so I need to use JTextPane or JEditorPane. From googling JTextPane seems simpler but I still cant understand how I actually add text
14 Replies
⌛
This post has been reserved for your question.
Hey @blockgoblin31! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose 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.
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
but how would I use that to color specific parts of the text? wouldn't that color the whole thing then the text is set?
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
no, I was mostly working from this https://stackoverflow.com/questions/9650992/how-to-change-text-color-in-the-jtextarea
Stack Overflow
How to change text color in the JTextArea?
I need to know how to do this:
Let's say: I have a code in the JTextArea like this:
LOAD R1, 1
DEC R1
STORE M, R1
ADD R4, R1,8
I wanted to change the color of LOAD, DEC, STORE and ADD to color B...
I just cant figure out what that's doing to add more text
and what you linked is using the same code pretty much
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
ok, I think that makes sense
how do I set the default side of the window?
in columns and rows
also it isn't working
using this code
s is just a wrapper for a Color and a char
set is an AttributeSet where im just changing out the color
actually heres the full class
and here's Symbol.java
@imp_o_rt
💤
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.
bump
💤
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.