| Share this post! | Vote this! |
|
Here we go. This example is used to illustrate that “how we can use
color class in java?” We several time need to color our panel, label, or
form. For this java provide us Color class in awt package i.e
“java.awt.Color.java”.
This class has seven - number of constructor. But the widely used constructors are following:
This class has seven - number of constructor. But the widely used constructors are following:
- Color(int r, int g, int b) : In this constructor we have to pass 3 argument of integer type ranging from 0-255, i.e. for Red, Green and Blue or usually know as RGB value.
- Color(int r, int g, int b, int a) : This constructor creates a RGB color with the specified red, green, blue, and alpha values in the range (0 - 255).
- Color(int rgb) : This constructor is used to pass the RGB value by a single integer value, i.e. all the three color code will have the same value at a particular time. more...




0 comments:
Post a Comment