• 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

Simple STRING Question!

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I've searched the forums and the API, but I can't find what I'm looking for!

I have say, a JTextArea, in which there are some strings. My problem is that I want the strings to be different colours. The only method I can find it the setForeGround(Color c) for the JTextArea, but this is no good as it colours all the text the same!

Surely there is a way to colour individual letters/words/strings differently??

If there isn't - please let me know. I found a post from 2001 asking something similar but with no answers! eek

Please help

Thanks for your time

Mike
[ February 17, 2005: Message edited by: Mike Smike ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JEditorPane supports HTML and Rich Text:
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JEditorPane.html
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike,

- Take a look at
Using text Components

- jEditorPane (or jTextPane) should meet your needs.

Hope that helps,
 
Mike Smike
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankyou muchos amigos! Very much appreciated. I will have a look at these JEditorPane and JTextPane things.

Mike
 
Don't MAKE me come back there with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic