Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Coloring Text  RSS feed

 
Atrus Greyor
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I color text in a JEditorPane based on what the word is in an efficient and effective way? I tried searching it, but the best way I've seen is to use the <font> HTML tag. Which is soon followed by a disclaimer that it is not very efficient.

A good example of what I want to is like the editor Eclipse, which color the keywords.

Thanks for you help!
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've only done this once. Here we append a message in a color based on an event type:

I don't know about efficiency ... try one approach or the other and see how it performs. Chances are pretty good this won't be the bottleneck in your system.
[ August 24, 2007: Message edited by: Stan James ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!