Solved

how to use light colour combination  in applet

Posted on 2001-06-14
4
170 Views
Last Modified: 2010-03-31
Hi
I am working for games .
But through setBackground()and setForeground()method i am able to use only few main colours .
like
Color.black
Color.red
Color.yellow
Color.green
Color.pink
Color.orange
Color.magenta
Color.cyan
Color.gray
Could someone tell me suppose if i want to use except above colours like light colours or Olive,lightgreen,maroon ,purple,Naviblue then what i have to do ,how and what will be the coding for that .Because when i am trying to use maroon colour(setBackground(Color.maroon)its giving me the error "can't resolve symbol"


0
Comment
Question by:rkalpana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 10 total points
ID: 6190359
Have a look at the constructors for java.awt.Color. They enable you to specify the exact rbg combinations you require.
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 6190367
The only colors you can refer to by name are :

black
blue
cyan
darkGray
gray
green
lightGray
magenta
orange
pink
red
white
yellow

Any other color you want to use you will have to create using the Color() constructors :

Color(ColorSpace cspace, float[] components, float alpha)
Color(float r, float g, float b)
Color(float r, float g, float b, float a)
Color(int rgb)
Color(int rgba, boolean hasalpha)
Color(int r, int g, int b)
Color(int r, int g, int b, int a)


0
 
LVL 92

Expert Comment

by:objects
ID: 6190379
And if rgb's aren't your thing (like most humans), here are the rbg's for color names:

http://eies.njit.edu/~kevin/rgb.txt.html
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 8950697


No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


--  points to objects


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question