|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.awt.Color
, Transparency
, Serializable

, SystemColor

public class Color

, Serializable

The Color class is used to encapsulate colors in the default
sRGB color space or colors in arbitrary color spaces identified by a
ColorSpace
. Every color has an implicit alpha value of 1.0 or
an explicit one provided in the constructor. The alpha value
defines the transparency of a color and can be represented by
a float value in the range 0.0 - 1.0 or 0 - 255.
An alpha value of 1.0 or 255 means that the color is completely
opaque and an alpha value of 0 or 0.0 means that the color is
completely transparent.
When constructing a Color with an explicit alpha or
getting the color/alpha components of a Color, the color
components are never premultiplied by the alpha component.
The default color space for the Java 2D(tm) API is sRGB, a proposed standard RGB color space. For further information on sRGB, see http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html .
ColorSpace
,
AlphaComposite
,
Serialized Form| Field Summary | |
|---|---|
static Color |
black
The color black. |
static Color |
BLACK
The color black. |
static Color |
blue
The color blue. |
static Color |
BLUE
The color blue. |
static Color |
cyan
The color cyan. |
static Color |
CYAN
The color cyan. |
static Color |
DARK_GRAY
The color dark gray. |
static Color |
darkGray
The color dark gray. |
static Color |
gray
The color gray. |
static Color |
GRAY
The color gray. |
static Color |
green
The color green. |
static Color |
GREEN
The color green. |
static Color |
LIGHT_GRAY
The color light gray. |
static Color |
lightGray
The color light gray. |
static Color |
magenta
The color magenta. |
static Color |
MAGENTA
The color magenta. |
static Color |
orange
The color orange. |
static Color |
ORANGE
The color orange. |
static Color |
pink
The color pink. |
static Color |
PINK
The color pink. |
static Color |
red
The color red. |
static Color |
RED
The color red. |
static Color |
white
The color white. |
static Color |
WHITE
The color white. |
static Color |
yellow
The color yellow. |
static Color |
YELLOW
The color yellow. |
Fields inherited from interface java.awt.Transparency ![]() |
|---|
BITMASK |
| Constructor Summary | |
|---|---|
Color
Creates a color in the specified ColorSpace
with the color components specified in the float
array and the specified alpha. |
|
Color
Creates an opaque sRGB color with the specified red, green, and blue values in the range (0.0 - 1.0). |
|
Color
Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0.0 - 1.0). |
|
Color
Creates an opaque sRGB 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
Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. |
|
Color
Creates an opaque sRGB color with the specified red, green, and blue values in the range (0 - 255). |
|
Color
Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 - 255). |
|
| Method Summary | |
|---|---|
Color |
brighter
Creates a new Color that is a brighter version of this
Color. |
PaintContext |
createContext
Creates and returns a PaintContext used to generate a solid
color pattern. |
Color |
darker
Creates a new Color that is a darker version of this
Color. |
static Color |
decode
Converts a String to an integer and returns the
specified opaque Color. |
boolean |
equals
Determines whether another object is equal to this Color. |
int |
getAlpha
Returns the alpha component in the range 0-255. |
int |
getBlue
Returns the blue component in the range 0-255 in the default sRGB space. |
static Color |
getColor
Finds a color in the system properties. |
static Color |
getColor
Finds a color in the system properties. |
static Color |
getColor
Finds a color in the system properties. |
float[] |
getColorComponents
Returns a float array containing only the color
components of the Color in the
ColorSpace specified by the cspace
parameter. |
float[] |
getColorComponents
Returns a float array containing only the color
components of the Color, in the
ColorSpace of the Color. |
ColorSpace |
getColorSpace
Returns the ColorSpace of this Color. |
float[] |
getComponents
Returns a float array containing the color and alpha
components of the Color, in the
ColorSpace specified by the cspace
parameter. |
float[] |
getComponents
Returns a float array containing the color and alpha
components of the Color, in the
ColorSpace of the Color. |
int |
getGreen
Returns the green component in the range 0-255 in the default sRGB space. |
static Color |
getHSBColor
Creates a Color object based on the specified values
for the HSB color model. |
int |
getRed
Returns the red component in the range 0-255 in the default sRGB space. |
int |
getRGB
Returns the RGB value representing the color in the default sRGB ColorModel . |
float[] |
getRGBColorComponents
Returns a float array containing only the color
components of the Color, in the default sRGB color
space. |
float[] |
getRGBComponents
Returns a float array containing the color and alpha
components of the Color, as represented in the default
sRGB color space. |
int |
getTransparency
Returns the transparency mode for this Color. |
int |
hashCode
Computes the hash code for this Color. |
static int |
HSBtoRGB
Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model. |
static float[] |
RGBtoHSB
Converts the components of a color, as specified by the default RGB model, to an equivalent set of values for hue, saturation, and brightness that are the three components of the HSB model. |
String |
toString
Returns a string representation of this Color. |
Methods inherited from class java.lang.Object ![]() |
|---|
clone |
| Field Detail |
|---|

public static final Color![]()
![]()
white

public static final Color![]()
![]()
WHITE

public static final Color![]()
![]()
lightGray

public static final Color![]()
![]()
LIGHT_GRAY

public static final Color![]()
![]()
gray

public static final Color![]()
![]()
GRAY

public static final Color![]()
![]()
darkGray

public static final Color![]()
![]()
DARK_GRAY

public static final Color![]()
![]()
black

public static final Color![]()
![]()
BLACK

public static final Color![]()
![]()
red

public static final Color![]()
![]()
RED

public static final Color![]()
![]()
pink

public static final Color![]()
![]()
PINK

public static final Color![]()
![]()
orange

public static final Color![]()
![]()
ORANGE

public static final Color![]()
![]()
yellow

public static final Color![]()
![]()
YELLOW

public static final Color![]()
![]()
green

public static final Color![]()
![]()
GREEN

public static final Color![]()
![]()
magenta

public static final Color![]()
![]()
MAGENTA

public static final Color![]()
![]()
cyan

public static final Color![]()
![]()
CYAN

public static final Color![]()
![]()
blue

public static final Color