Teen Programmers Unite  
 

 

Return to forum top

JAVA: Changing font style/color within a javax.swing.JTextArea

Posted by AnyoneEB [send private reply] at May 16, 2002, 06:47:25 PM

As the topic said: I would like to know how to change the font style/color within a javax.swing.JTextArea.

Posted by taubz [send private reply] at May 16, 2002, 07:55:51 PM

There aren't getFont and setFont? Look up the JTextArea class in the SDK documenation.

- taubz

Posted by AnyoneEB [send private reply] at May 16, 2002, 09:07:31 PM

getFont and setFont affect the whole JTextArea, I need to change the font either by line or by word/character. If it's not possible with a JTextArea, another swing text component wouldn't cahnge my program that much, it just has to have multi=line support.

Posted by taubz [send private reply] at May 17, 2002, 03:44:50 PM

If you've read the SDK page and you don't see a function that does it, then (obviously) what you are trying to do cannot be done.

I'm not familiar with Swing components, so I can't help you find another one.

- taubz

Posted by Psion [send private reply] at May 17, 2002, 04:34:36 PM

You might want to look into using some control that displays HTML, if that works with whatever your purpose is.

Posted by AnyoneEB [send private reply] at May 17, 2002, 04:57:54 PM

I know there's a way to do it, but reading the API I couldn't figure it out.

I think I saw something about displaying HTML, but it really wasn't clear how to use it.

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.