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 ...

Recommended Answers

All 5 Replies

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

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

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 !

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.