Solved

how to use light colour combination  in applet

Posted on 2001-06-14
4
168 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
  • 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 96
split53 challenge 7 97
javap not working 8 46
Java: anonymous class 4 22
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

809 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