0

can some one help me write a program, that works when passing 3 values (r g b value), to a Color class and outputs its corresponding colour..

please help me by giving a sample code and the output ...

3
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by Ezzaral
0

please help me by giving a sample code and the output ...

please help us by showing what you've tried so far

0
int r=245;
int g = 90;
int b =78;

Color c = new Color(r,g,b);

c.  // <<--- then i dont know what methos to call

//and i am not sure how to display the colour

i am a beginner !

0

I don't totally get what you 're trying to do, but this would be a good place to start looking:
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Color.html

this is what i am trying to do,,, i am trying to pass 3 int values in to the Color constructor...
and i want to see the correspoding colour of the integer to display ...

example if we pass 255 0 0, we should see the colour RED visible as output

0

Assuming this is in a GUI, set the background color of one of your components to that color. You could create a JLabel for that purpose, or just use the background of your existing frame/panel.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.