• Post Reply Bookmark Topic Watch Topic
  • New Topic

Alternate Displayed Colors  RSS feed

 
Arthur Buliva
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this short code



which the JtextArea displays with the last color I have specified. I however, would like it to alternate the color. Anyone?
 
Brian Cole
Author
Ranch Hand
Posts: 947
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTextArea uses a single style for all its text. Use a JTextPane if you want to display multiple styles. Here's an example that more or less does what you are trying to do.

[edit: fix typo]
[ June 20, 2007: Message edited by: Brian Cole ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!