Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-25-2004, 08:32 PM   PM User | #1
alaios
Regular Coder

 
Join Date: Aug 2002
Posts: 433
Thanks: 3
Thanked 0 Times in 0 Posts
alaios is an unknown quantity at this point
Java Questions...

Hi i am trying to learn Java but i have some problems... If you can help me ...

I want to know how i can show dynamicaly the fonts provided by my operating System in a choise (Fonts =new Choice()?

I want also need a choice for changing the colors of a string... I know how to create some colors in the choice...
Choice Fontcolor=new Choice();
Fontcolor.addItem("Red");
Fontcolor.addItem("Blue");

Do u know something better than this? For example something that i can use it immediately for changing the color.... I was thinkink if it is possible instead of text colors ..... to use colored lines in the choice... Is this possible?

Finally how i can change the color of a String?
I have a String inside a TextArea...i can;t find any option for this? Any suggestion?
Thx
alaios is offline   Reply With Quote
Old 05-26-2004, 11:03 PM   PM User | #2
sad69
Senior Coder

 
Join Date: Feb 2004
Posts: 1,206
Thanks: 0
Thanked 0 Times in 0 Posts
sad69 is an unknown quantity at this point
For the TextArea, I think you have to use setForeground() to change the colour of the text. A String doesn't have a color property, neither does Font (to my knowledge..).

I don't know of anyway to 'loop through' the available fonts on the system. You pretty much have to know the name of the font you want.

You may want to use a color chooser as opposed to the dropdown thing you've got. Take a look at this tutorial:
http://java.sun.com/docs/books/tutor...orchooser.html

Hope that helps,
Sadiq.
sad69 is offline   Reply With Quote
Old 05-28-2004, 10:36 AM   PM User | #3
alaios
Regular Coder

 
Join Date: Aug 2002
Posts: 433
Thanks: 3
Thanked 0 Times in 0 Posts
alaios is an unknown quantity at this point
thx

thx again.... Of course it wil be veru helpful if someone knew ... how i could change the color of the Text
alaios is offline   Reply With Quote
Old 05-28-2004, 08:15 PM   PM User | #4
sad69
Senior Coder

 
Join Date: Feb 2004
Posts: 1,206
Thanks: 0
Thanked 0 Times in 0 Posts
sad69 is an unknown quantity at this point
You'd change the colour of the TextArea's foreground using setForeground() to change the colour of the text.

If you're drawing a string to the screen, you need to set the colour of the Graphics object you're using.

Sadiq.
sad69 is offline   Reply With Quote
Old 05-29-2004, 06:39 AM   PM User | #5
alaios
Regular Coder

 
Join Date: Aug 2002
Posts: 433
Thanks: 3
Thanked 0 Times in 0 Posts
alaios is an unknown quantity at this point
thx

If you can hel me more...Can u give some more code... I only want to change the Font Color in my TextArea
alaios is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:52 PM.


Advertisement
Log in to turn off these ads.