API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.awt. Color View Source
Author(s)
Sami Shaio
Arthur van Hoff
Since
Version
10 Feb 1997
Serial
Hierarchy
 Object
      Color
Implements
 Paint
 Serializable
Subclasses
Description
public class Color
  The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary color spaces identified by a ColorSpace.
See also:    ColorSpace AlphaComposite
Constructors
public Color (ColorSpace cspace, float[] components, float alpha)
  Creates a color in the specified ColorSpace with the color components specified in the float array and the specified alpha.
public Color (float r, float g, float b)
  Creates an opaque sRGB color with the specified red, green, and blue values in the range (0.0 - 1.0).
public Color (float r, float g, float b, float a)
  Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0.0 - 1.0).
public Color (int rgb)
  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.
public Color (int rgba, boolean hasalpha)
  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.
public Color (int r, int g, int b)
  Creates an opaque sRGB color with the specified red, green, and blue values in the range (0 - 255).
public Color (int r, int g, int b, int a)
  Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 - 255).
Methods
Hide/Show inherited methods
public Color brighter ()
  Creates a new Color that is a brighter version of this Color.
publicsynchronized PaintContext createContext (ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints) [Specified in Paint]
  Creates and returns a PaintContext used to generate a solid color pattern.
public Color darker ()
  Creates a new Color that is a darker version of this Color.
publicstatic Color decode (String nm) throws NumberFormatException
  Converts a String to an integer and returns the specified opaque Color.
public boolean equals (Object obj)
  Determines whether another object is equal to this Color.
public int getAlpha ()
  Returns the alpha component in the range 0-255.
public int getBlue ()
  Returns the blue component in the range 0-255 in the default sRGB space.
publicstatic Color getColor (String nm)
  Finds a color in the system properties.
publicstatic Color getColor (String nm, Color v)
  Finds a color in the system properties.
publicstatic Color getColor (String nm, int v)
  Finds a color in the system properties.
public float getColorComponents (ColorSpace cspace, float[] compArray)
  Returns a float array containing only the color components of the Color in the ColorSpace specified by the cspace parameter.
public float getColorComponents (float[] compArray)
  Returns a float array containing only the color components of the Color, in the ColorSpace of the Color.
public ColorSpace getColorSpace ()
  Returns the ColorSpace of this Color.
public float getComponents (ColorSpace cspace, float[] compArray)
  Returns a float array containing the color and alpha components of the Color, in the ColorSpace specified by the cspace parameter.
public float getComponents (float[] compArray)
  Returns a float array containing the color and alpha components of the Color, in the ColorSpace of the Color.
public int getGreen ()
  Returns the green component in the range 0-255 in the default sRGB space.
publicstatic Color getHSBColor (float h, float s, float b)
  Creates a Color object based on the specified values for the HSB color model.
public int getRed ()
  Returns the red component in the range 0-255 in the default sRGB space.
public int getRGB ()
  Returns the RGB value representing the color in the default sRGB ColorModel.
public float getRGBColorComponents (float[] compArray)
  Returns a float array containing only the color components of the Color, in the default sRGB color space.
public float getRGBComponents (float[] compArray)
  Returns a float array containing the color and alpha components of the Color, as represented in the default sRGB color space.
public int getTransparency ()
  Returns the transparency mode for this Color.
public int hashCode ()
  Computes the hash code for this Color.
publicstatic int HSBtoRGB (float hue, float saturation, float brightness)
  Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model.
publicstatic float RGBtoHSB (int r, int g, int b, float[] hsbvals)
  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.
public String toString ()
  Returns a string representation of this Color.
Fields
Hide/Show inherited fields
publicfinalstatic int BITMASK = "2" [Inherited From Paint]
Represents image data that is guaranteed to be either completely opaque, with an alpha value of 1.0, or completely transparent, with an alpha value of 0.0.
publicfinalstatic Color black
  The color black.
publicfinalstatic Color BLACK
  The color black.
publicfinalstatic Color blue
  The color blue.
publicfinalstatic Color BLUE
  The color blue.
publicfinalstatic Color cyan
  The color cyan.
publicfinalstatic Color CYAN
  The color cyan.
publicfinalstatic Color DARK_GRAY
  The color dark gray.
publicfinalstatic Color darkGray
  The color dark gray.
publicfinalstatic Color gray
  The color gray.
publicfinalstatic Color GRAY
  The color gray.
publicfinalstatic Color green
  The color green.
publicfinalstatic Color GREEN
  The color green.
publicfinalstatic Color LIGHT_GRAY
  The color light gray.
publicfinalstatic Color lightGray
  The color light gray.
publicfinalstatic Color magenta
  The color magenta.
publicfinalstatic Color MAGENTA
  The color magenta.
publicfinalstatic int OPAQUE = "1" [Inherited From Paint]
Represents image data that is guaranteed to be completely opaque, meaning that all pixels have an alpha value of 1.0.
publicfinalstatic Color orange
  The color orange.
publicfinalstatic Color ORANGE
  The color orange.
publicfinalstatic Color pink
  The color pink.
publicfinalstatic Color PINK
  The color pink.
publicfinalstatic Color red
  The color red.
publicfinalstatic Color RED
  The color red.
publicfinalstatic int TRANSLUCENT = "3" [Inherited From Paint]
Represents image data that contains or might contain arbitrary alpha values between and including 0.0 and 1.0.
pack-private int value
  The color value.
publicfinalstatic Color white
  The color white.
publicfinalstatic Color WHITE
  The color white.
publicfinalstatic Color yellow
  The color yellow.
publicfinalstatic Color YELLOW
  The color yellow.
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar