All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.Color

java.lang.Object
   |
   +----java.awt.Color

public class Color
extends Object
implements Serializable
A class to encapsulate RGB Colors.


Variable Index

 o black
The color black.
 o blue
The color blue.
 o cyan
The color cyan.
 o darkGray
The color dark gray.
 o gray
The color gray.
 o green
The color green.
 o lightGray
The color light gray.
 o magenta
The color magneta.
 o orange
The color orange.
 o pink
The color pink.
 o red
The color red.
 o white
The color white.
 o yellow
The color yellow.

Constructor Index

 o Color(float, float, float)
Creates a color with the specified red, green, and blue values in the range (0.0 - 1.0).
 o Color(int)
Creates a color with the specified combined RGB value consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.
 o Color(int, int, int)
Creates a color with the specified red, green, and blue values in the range (0 - 255).

Method Index

 o brighter()
Returns a brighter version of this color.
 o darker()
Returns a darker version of this color.
 o decode(String)
Gets the specified Color.
 o equals(Object)
Compares this object against the specified object.
 o getBlue()
Gets the blue component.
 o getColor(String)
Gets the specified Color property.
 o getColor(String, Color)
Gets the specified Color property of the specified Color.
 o getColor(String, int)
Gets the specified Color property of the color value.
 o getGreen()
Gets the green component.
 o getHSBColor(float, float, float)
A static Color factory for generating a Color object from HSB values.
 o getRed()
Gets the red component.
 o getRGB()
Gets the RGB value representing the color in the default RGB ColorModel.
 o hashCode()
Computes the hash code.
 o HSBtoRGB(float, float, float)
Returns the RGB value defined by the default RGB ColorModel, of the color corresponding to the given HSB color components.
 o RGBtoHSB(int, int, int, float[])
Returns the HSB values corresponding to the color defined by the red, green, and blue components.
 o toString()
Returns the String representation of this Color's values.

Variables

 o white
Properties Public Constant 
    white=Color 
The color white.

 o lightGray
Properties Public Constant 
    lightGray=Color 
The color light gray.

 o gray
Properties Public Constant 
    gray=Color 
The color gray.

 o darkGray
Properties Public Constant 
    darkGray=Color 
The color dark gray.

 o black
Properties Public Constant 
    black=Color 
The color black.

 o red
Properties Public Constant 
    red=Color 
The color red.

 o pink
Properties Public Constant 
    pink=Color 
The color pink.

 o orange
Properties Public Constant 
    orange=Color 
The color orange.

 o yellow
Properties Public Constant 
    yellow=Color 
The color yellow.

 o green
Properties Public Constant 
    green=Color 
The color green.

 o magenta
Properties Public Constant 
    magenta=Color 
The color magneta.

 o cyan
Properties Public Constant 
    cyan=Color 
The color cyan.

 o blue
Properties Public Constant 
    blue=Color 
The color blue.

Constructors

 o Color
    method Color(r=int, -
                 g=int, -
                 b=int) public 
Creates a color with the specified red, green, and blue values in the range (0 - 255). The actual color used in rendering will depend on finding the best match given the color space available for a given output device.

Parameters:
r - the red component
g - the green component
b - the blue component
See Also:
getRed, getGreen, getBlue, getRGB
 o Color
    method Color(rgb=int) public 
Creates a color with the specified combined RGB value consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. The actual color used in rendering will depend on finding the best match given the color space available for a given output device.

Parameters:
rgb - the combined RGB components
See Also:
getRGBdefault, getRed, getGreen, getBlue, getRGB
 o Color
    method Color(r=float, -
                 g=float, -
                 b=float) public 
Creates a color with the specified red, green, and blue values in the range (0.0 - 1.0). The actual color used in rendering will depend on finding the best match given the color space available for a given output device.

Parameters:
r - the red component
g - the red component
b - the red component
See Also:
getRed, getGreen, getBlue, getRGB

Methods

 o getRed
    method getRed() returns int public     
Gets the red component.

See Also:
getRGB
 o getGreen
    method getGreen() returns int public     
Gets the green component.

See Also:
getRGB
 o getBlue
    method getBlue() returns int public     
Gets the blue component.

See Also:
getRGB
 o getRGB
    method getRGB() returns int public     
Gets the RGB value representing the color in the default RGB ColorModel. (Bits 24-31 are 0xff, 16-23 are red, 8-15 are green, 0-7 are blue).

See Also:
getRGBdefault, getRed, getGreen, getBlue
 o brighter
    method brighter() returns Color public     
Returns a brighter version of this color.

 o darker
    method darker() returns Color public     
Returns a darker version of this color.

 o hashCode
    method hashCode() returns int public     
Computes the hash code.

Overrides:
hashCode in class Object
 o equals
    method equals(obj=Object) returns boolean public     
Compares this object against the specified object.

Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.
Overrides:
equals in class Object
 o toString
    method toString() returns String public     
Returns the String representation of this Color's values.

Overrides:
toString in class Object
 o decode
    method decode(nm=String) returns Color public  static   Signals NumberFormatException
Gets the specified Color.

Parameters:
nm - representation of the color as a 24-bit integer
Returns:
the new color
 o getColor
    method getColor(nm=String) returns Color public  static   
Gets the specified Color property.

Parameters:
nm - the name of the color property
 o getColor
    method getColor(nm=String, -
                    v=Color) returns Color public  static   
Gets the specified Color property of the specified Color.

Parameters:
nm - the name of the color property
v - the specified color
Returns:
the new color.
 o getColor
    method getColor(nm=String, -
                    v=int) returns Color public  static   
Gets the specified Color property of the color value.

Parameters:
nm - the name of the color property
v - the color value
Returns:
the new color.
 o HSBtoRGB
    method HSBtoRGB(hue=float, -
                    saturation=float, -
                    brightness=float) returns int public  static   
Returns the RGB value defined by the default RGB ColorModel, of the color corresponding to the given HSB color components.

Parameters:
hue - the hue component of the color
saturation - the saturation of the color
brightness - the brightness of the color
See Also:
getRGBdefault, getRGB
 o RGBtoHSB
    method RGBtoHSB(r=int, -
                    g=int, -
                    b=int, -
                    hsbvals=float[]) returns float[] public  static   
Returns the HSB values corresponding to the color defined by the red, green, and blue components.

Parameters:
r - the red component of the color
g - the green component of the color
b - the blue component of the color
hsbvals - the array to be used to return the 3 HSB values, or null
Returns:
the array used to store the results [hue, saturation, brightness]
See Also:
getRGBdefault, getRGB
 o getHSBColor
    method getHSBColor(h=float, -
                       s=float, -
                       b=float) returns Color public  static   
A static Color factory for generating a Color object from HSB values.

Parameters:
h - the hue component
s - the saturation of the color
b - the brightness of the color
Returns:
the Color object for the corresponding RGB color

All Packages  Class Hierarchy  This Package  Previous  Next  Index