> color control java ~ Online tutorial

color control java

Color Control



colors  enhance the appearance of a program and help convey meaning.
For example, a traffic light has three different color lights—red indicates stop, yellow indicates caution and
green indicates go.
Class Color defines methods and constants for manipulating colors in a Java program.


Color Constant Color RGB value
public final static Color orange orange 255, 200, 0
public final static Color pink pink 255, 175, 175
public final static Color cyan cyan 0, 255, 255
public final static Color yellow yellow 255, 0, 255
public final static Color black black 255, 255, 0
public final static Color white white 0, 0, 0
public final static Color gray gray 255, 255, 255
public final static Color lightGray lightGray 128, 128, 128
public final static Color darkGray darkGray 192, 192, 192




public Color( int r, int g, int b )
Creates a color based on red, green and blue contents expressed as integers
from 0 to 255.
public Color( float r, float g, float b )
Creates a color based on red, green and blue contents expressed as floatingpoint
values from 0.0 to 1.0.
public int getRed()  // Color class
Returns a value between 0 and 255 representing the red content.
public int getGreen()  // Color class
Returns a value between 0 and 255 representing the green content.
public int getBlue() // Color class
Returns a value between 0 and 255 representing the blue content.
public Color getColor() // Graphics class
Returns a Color object representing the current color for the graphics context.
public void setColor( Color c ) // Graphics class
Sets the current color for drawing with the graphics context



Buy It Now

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: