public class Color extends Object
A color is defined as a mixture of red, green and blue color values. Each value is in the range of 0 to 255 where 0 is darkest and 255 is brightest. For example, Color(255, 0, 0) is the color red.
Here are some more examples:
Modifier and Type | Field and Description |
---|---|
static Color |
Black |
static Color |
DarkBlue |
static Color |
DarkGray |
static Color |
DisabledBlack |
static Color |
LightBlue |
static Color |
LighterBlue |
static Color |
LighterGray |
static Color |
LightGray |
static Color |
LightGreen |
static Color |
MediumBlue |
static Color |
Null |
static Color |
Pink |
static Color |
Red |
static Color |
Sand |
static Color |
White |
Constructor and Description |
---|
Color() |
Color(int red,
int green,
int blue)
Constructs a color object with the given red, green and blue values.
|
Color(int red,
int green,
int blue,
int alpha) |
Modifier and Type | Method and Description |
---|---|
void |
cache() |
boolean |
equals(Object other)
Returns if this object is considered equal to the other object.
|
void |
fromInt(int value) |
int |
getAlpha() |
int |
getBlue()
Returns the blue value of the color.
|
static Color |
getCached() |
static Color |
getCached(Color other) |
static Color |
getCached(int r,
int g,
int b) |
Color |
getCopy() |
int |
getGreen()
Returns the green value of the color.
|
static boolean |
getMonochrome() |
static Color |
getNoColor() |
int |
getRed()
Returns the red value of the color.
|
static boolean |
isNoColor(Color c) |
boolean |
isNull() |
static boolean |
isNull(Color c) |
void |
set(Color other) |
void |
set(int r,
int g,
int b) |
void |
set(int r,
int g,
int b,
int a) |
static void |
setMonochrome(boolean mono) |
void |
setNull(boolean set) |
int |
toInt() |
static int |
toInt(int red,
int green,
int blue,
int alpha) |
Color |
toOpaque() |
String |
toString()
Return a String representation of this object.
|
public static final Color Null
public static Color Black
public static Color White
public static Color DarkGray
public static Color LightGray
public static Color LighterGray
public static Color DarkBlue
public static Color Sand
public static Color LightBlue
public static Color LighterBlue
public static Color MediumBlue
public static Color LightGreen
public static Color Pink
public static Color Red
public static Color DisabledBlack
public Color()
public Color(int red, int green, int blue)
red
- the red value in the range of 0 to 255green
- the green value in the range of 0 to 255blue
- the blue value in the range of 0 to 255public Color(int red, int green, int blue, int alpha)
public void setNull(boolean set)
public boolean isNull()
public static boolean isNull(Color c)
public int getBlue()
public int getGreen()
public int getRed()
public int getAlpha()
public static boolean isNoColor(Color c)
public static Color getNoColor()
public static void setMonochrome(boolean mono)
public static boolean getMonochrome()
public void set(int r, int g, int b)
public void set(int r, int g, int b, int a)
public void set(Color other)
public String toString()
Object
public boolean equals(Object other)
Object
public static int toInt(int red, int green, int blue, int alpha)
public int toInt()
public void fromInt(int value)
public Color toOpaque()
public Color getCopy()
public static Color getCached(int r, int g, int b)
public static Color getCached()
public void cache()