Click to See Complete Forum and Search --> : setting colors to font


rajaraj
September 30th, 2000, 02:27 PM
how to set color to a particular font in'
the text area?
help

unicman
October 1st, 2000, 03:26 PM
I didn't understand your question exactly.

If you want to have color for whole text in text area depending on what font is set, you can create sub-class of text area and have a hashtable there which will relate fontnames and collors. And in 'setFont' method you can set appropriate color.

If you want text in text area with different colors, java has provided info in JDK1.3 documentation. See javax.swing.JTextComponent. There you will find 'General rules...' link which will take you to java's page for showing multi-colored (styled) text.
Using java.awt.TextArea you cant do such a thing... at least I don't know about it.

- UnicMan
http://members.tripod.com/unicman