The hashCode() method in this class uses the values of the public fields to compute the hash value. When storing instances of the class in hashed collections, do not modify these fields after the object has been inserted.
Application code does not need to explicitly release the
resources managed by each instance when those instances are no longer
required, and thus no dispose() method is provided.
Color, Color and RGB snippets, Sample code and further information
| Modifier and Type | Field and Description |
|---|---|
| public int | blue
the blue component of the RGB |
| public int | green
the green component of the RGB |
| public int | red
the red component of the RGB |
| pack-priv static final long |
| Access | Constructor and Description |
|---|---|
| public | RGB(int
the red component of the new instance red, int the green component of the new instance green, int the blue component of the new instance blue)Constructs an instance of this class with the given red, green and blue values. |
| public | RGB(float
the hue value for the HSB color (from 0 to 360) hue, float the saturation value for the HSB color (from 0 to 1) saturation, float the brightness value for the HSB color (from 0 to 1) brightness)Constructs an instance of this class with the given hue, saturation, and brightness. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the object is the same as this object and false otherwisethe object to compare with this object object)Overrides java. |
| public float[] | Returns: color space values in float format:
Returns the hue, saturation, and brightness of the color. |
| public int | Returns: the receiver's hashOverrides java. |
| public String | Returns: a string representation of theRGBOverrides java. |
| blue | back to summary |
|---|---|
| public int blue the blue component of the RGB | |
| green | back to summary |
|---|---|
| public int green the green component of the RGB | |
| red | back to summary |
|---|---|
| public int red the red component of the RGB | |
| serialVersionUID | back to summary |
|---|---|
| pack-priv static final long serialVersionUID | |
| RGB | back to summary |
|---|---|
| public RGB(int red, int green, int blue) Constructs an instance of this class with the given red, green and blue values.
| |
| RGB | back to summary |
|---|---|
| public RGB(float hue, float saturation, float brightness) Constructs an instance of this class with the given hue, saturation, and brightness.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object object) Overrides java. Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
| |
| getHSB | back to summary |
|---|---|
| public float[] getHSB() Returns the hue, saturation, and brightness of the color.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns an integer hash code for the receiver. Any two
objects that return
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string containing a concise, human-readable description of the receiver. | |