Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Swing / AWT / SWT
setting different text colours
james barrett
Greenhorn
Posts: 8
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi all,
im trying to set different colours for different lines of text in a JTextArea, but the setForeground method changes the entire thing, is there a way to change just one line.
e.g
black text --> hello
green text --> bye
black text --> hello again!
thanks
j
Paul Clapham
Marshal
Posts: 28193
95
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
No, there isn't. You need to use one of the other similar text components for that.
james barrett
Greenhorn
Posts: 8
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
other text componants? you mean like a textpane and such?
Paul Clapham
Marshal
Posts: 28193
95
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Read this tutorial and you will get much more useful information than just the bare answer to your question:
Using Text Components
.
By the way, I got this link from the API documentation for the JTextArea class. Sun's tutorials are usually worth reading.
james barrett
Greenhorn
Posts: 8
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hehe thanks, i had just stumbled over that now
thanks for the help
j
Campbell Ritchie
Marshal
Posts: 79179
377
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Sounds like a Swing-specific question. Moving.
Replace the word "snake" with "danger noodle" in all tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JTextArea & Cursor
Setting colors
Simple STRING Question!
New set of buttons
How to set color of text in Text Area
More...