File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Alternate Displayed Colors Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Alternate Displayed Colors" Watch "Alternate Displayed Colors" New topic
Author

Alternate Displayed Colors

Arthur Buliva
Ranch Hand

Joined: Mar 08, 2006
Posts: 101
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

Joined: Sep 20, 2005
Posts: 852
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 ]

bitguru blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Alternate Displayed Colors
 
Similar Threads
starting a new line of text
I can't figure out why this is not working!
Swing: Unable to bring down the size of JPanel
Timers
Custom LookAndFeel and JTextArea (functional keys doesn't work)