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 / General / November 2005

Tip: Looking for answers? Try searching our database.

Easy Applet Question

Thread view: 
GRoll21 - 05 Nov 2005 15:32 GMT
Hey guys I'm new to java and just self-teaching my self. If i wanna set
the background to a color of my choice, i need the rgb numbers. so i
got them but how can I put them in so its correct syntax?

here is what I have..

setBackground(Color(135,206,250));

i've tried many things and looked in jdk and just don't understand it.
If anyone can tell me that would be great. Its so easy i'll feel stupid
when you tell me. Thanks for your help.
Roedy Green - 05 Nov 2005 15:53 GMT
>setBackground(Color(135,206,250));

you need setBackground(new Color(135,206,250));

or beter still:

private static final Color DARKTURQUOISE = new Color( 0x00ced1 );

setBackground( DARKTURQUOISE );

Or this way to make it easier to change the colour scheme:

// colours used
private static final Color DARKTURQUOISE = new Color( 0x00ced1 );
...
// colour scheme
public static final Color PANEL_BACKGROUND =  DARKTURQUOISE;
...
setBackground( PANEL_BACKGROUND );
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



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



©2009 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.