Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / August 2005

Tip: Looking for answers? Try searching our database.

setFont()

Thread view: 
Frances - 28 Aug 2005 05:09 GMT
Constructor for class Font:
(http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Font.html)

Font(String name, int style, int size)

what about color? how to set Font Color?

I'm working w/JTextArea, now realized need to use JTextPane b/c will
need diff. font colors depending on user input..  (nothing fancy, no
images, no HTML (at least I don't think I need to do w/html..) all font
attr's will remain constant, only font color will change.. (also would
like if user inputs url for it to be a link..)

I have just spent entire evening looking this up...  is not that
simple....;)  I'm going a bit dizzy...  ;)

thank you for any help...
Christian Kaufhold - 28 Aug 2005 11:36 GMT
Hello!

> what about color? how to set Font Color?

Fonts do not have color. The color is a separate attribute when some
text is actually painted.

> I'm working w/JTextArea, now realized need to use JTextPane b/c will
> need diff. font colors depending on user input..  (nothing fancy, no
> images, no HTML (at least I don't think I need to do w/html..) all font
> attr's will remain constant, only font color will change.. (also would
> like if user inputs url for it to be a link..)

textArea.setForeground

Christian
Roedy Green - 29 Aug 2005 08:38 GMT
>what about color? how to set Font Color?

In paint you do a Graphics.setColor().

In Components you do Component.setForeground and
Component.setBackground.

Font objects themselves do not have a colour.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.