Solved

how to use light colour combination  in applet

Posted on 2001-06-14
4
165 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility


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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
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 …

771 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

12 Experts available now in Live!

Get 1:1 Help Now