Color

Name

Color

[Graphic: Figure from the text]

Description

The Color class represents a specific color to the system.

Class Definition

public final class java.awt.Color extends java.lang.Object implements java.io.Serializable {
 // Constants public static final Color black;
public static final Color blue;
public static final Color cyan;
public static final Color darkGray;
public static final Color gray;
public static final Color green;
public static final Color lightGray;
public static final Color magenta;
public static final Color orange;
public static final Color pink;
public static final Color red;
public static final Color white;
public static final Color yellow; // Constructors public Color (int rgb);
public Color (int red, int green, int blue);
public Color (float red, float green, float blue); // Class Methods public static Color decode (String name); public static Color getColor (String name);
public static Color getColor (String name, Color defaultColor);
public static Color getColor (String name, int defaultColor);
public static Color getHSBColor (float hue, float saturation, float brightness);
public static int HSBtoRGB (float hue, float saturation, float brightness);
public static float[] RGBtoHSB (int red, int green, int blue, float hsbvalues[]); // Instance Methods public Color brighter();
public Color darker();
public boolean equals (Object object);
public int getBlue();
public int getGreen();
public int getRed();
public int getRGB();
public int hashCode();
public String toString();
}

Constants

black

public static final Color black

The color black.

blue

public static final Color blue

The color blue.

cyan

public static final Color cyan

The color cyan.

darkGray

public static final Color darkGray

The color dark gray.

gray

public static final Color gray

The color gray.

green

public static final Color green

The color green.

lightGray

public static final Color lightGray

The color light gray.

magenta

public static final Color magenta

The color magenta.

orange

public static final Color orange

The color orange.

pink

public static final Color pink

The color pink.

red

public static final Color red

The color red.

white

public static final Color white

The color white.

yellow

public static final Color yellow

The color yellow.

Constructors

Color

public Color (int rgb)

public Color (int red, int green, int blue)

public Color (float red, float green, float blue)

Class Methods

decode

public static Color decode (String nm)

getColor

public static Color getColor (String name)

public static Color getColor (String name, Color defaultColor)

public static Color getColor (String name, int defaultColor)

getHSBColor

public static Color getHSBColor (float hue, float saturation, float brightness)

HSBtoRGB

public static int HSBtoRGB (float hue, float saturation, float brightness)

RGBtoHSB

public static float[] RGBtoHSB (int red, int green, int blue, float[] hsbvalues)

Instance Methods

brighter

public Color brighter()

darker

public Color darker()

equals

public boolean equals (Object object)

getBlue

public int getBlue()

getGreen

public int getGreen()

getRed

public int getRed()

getRGB

public int getRGB()

hashCode

public int hashCode()

toString

public String toString()

See Also

Object, Properties, Serializable, String