|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Color
A class to encapsulate RGB Colors.
Field Summary | |
static Color |
black
The color black. |
static Color |
blue
The color blue. |
static Color |
cyan
The color cyan. |
static Color |
darkGray
The color dark gray. |
static Color |
gray
The color gray. |
static Color |
green
The color green. |
static Color |
lightGray
The color light gray. |
static Color |
magenta
The color magneta. |
static Color |
orange
The color orange. |
static Color |
pink
The color pink. |
static Color |
red
The color red. |
static Color |
white
The color white. |
static Color |
yellow
The color yellow. |
Constructor Summary | |
Color(float r,
float g,
float b)
Creates a color with the specified red, green, and blue values in the range (0.0 - 1.0). |
|
Color(int rgb)
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. |
|
Color(int r,
int g,
int b)
Creates a color with the specified red, green, and blue values in the range (0 - 255). |
Method Summary | |
Color |
brighter()
Returns a brighter version of this color. |
Color |
darker()
Returns a darker version of this color. |
boolean |
equals(Object obj)
Compares this object against the specified object. |
int |
getBlue()
Gets the blue component. |
static Color |
getColor(String nm)
Gets the specified Color property. |
static Color |
getColor(String nm,
Color v)
Gets the specified Color property of the specified Color. |
static Color |
getColor(String nm,
int v)
Gets the specified Color property of the color value. |
int |
getGreen()
Gets the green component. |
static Color |
getHSBColor(float h,
float s,
float b)
A static Color factory for generating a Color object from HSB values. |
int |
getRed()
Gets the red component. |
int |
getRGB()
Gets the RGB value representing the color in the default RGB ColorModel. |
int |
hashCode()
Computes the hash code. |
static int |
HSBtoRGB(float hue,
float saturation,
float brightness)
Returns the RGB value defined by the default RGB ColorModel, of the color corresponding to the given HSB color components. |
static float[] |
RGBtoHSB(int r,
int g,
int b,
float[] hsbvals)
Returns the HSB values corresponding to the color defined by the red, green, and blue components. |
String |
toString()
Returns the String representation of this Color's values. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Color white
public static final Color lightGray
public static final Color gray
public static final Color darkGray
public static final Color black
public static final Color red
public static final Color pink
public static final Color orange
public static final Color yellow
public static final Color green
public static final Color magenta
public static final Color cyan
public static final Color blue
Constructor Detail |
public Color(int r, int g, int b)
r
- the red componentg
- the green componentb
- the blue componentgetRed()
,
getGreen()
,
getBlue()
,
getRGB()
public Color(int rgb)
rgb
- the combined RGB componentsColorModel.getRGBdefault()
,
getRed()
,
getGreen()
,
getBlue()
,
getRGB()
public Color(float r, float g, float b)
r
- the red componentg
- the red componentb
- the red componentgetRed()
,
getGreen()
,
getBlue()
,
getRGB()
Method Detail |
public int getRed()
getRGB()
public int getGreen()
getRGB()
public int getBlue()
getRGB()
public int getRGB()
ColorModel.getRGBdefault()
,
getRed()
,
getGreen()
,
getBlue()
public Color brighter()
public Color darker()
public int hashCode()
hashCode
in class Object
Hashtable
public boolean equals(Object obj)
equals
in class Object
obj
- the object to compare with.
Hashtable
public String toString()
toString
in class Object
public static Color getColor(String nm)
nm
- the name of the color propertypublic static Color getColor(String nm, Color v)
nm
- the name of the color propertyv
- the specified color
public static Color getColor(String nm, int v)
nm
- the name of the color propertyv
- the color value
public static int HSBtoRGB(float hue, float saturation, float brightness)
hue
- the hue component of the colorsaturation
- the saturation of the colorbrightness
- the brightness of the colorColorModel.getRGBdefault()
,
getRGB()
public static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals)
r
- the red component of the colorg
- the green component of the colorb
- the blue component of the colorhsbvals
- the array to be used to return the 3 HSB values, or null
ColorModel.getRGBdefault()
,
getRGB()
public static Color getHSBColor(float h, float s, float b)
h
- the hue components
- the saturation of the colorb
- the brightness of the color
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |