Solved

how to use light colour combination  in applet

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
splitOdd10 challenge 5 80
groovy example issue 10 90
java  and programming certification ? 4 86
advertisement module in core php 4 145
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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 learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

896 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now