Class XColor
java.lang.Object
|
+----java.awt.Color
|
+----XColor
- public class XColor
- extends Color
A Color subclass that provides all the RGB color names from
The X Window System rgb.txt color database.
The X11 file rgb.txt contains 752 color
names and their RGB values. Many of these, however, are shades of gray
(also spelt grey), and most of the longer names appear as both one
word and multi-word ("deep sky blue" and "deepskyblue"). There are
perhaps 200-300 distinct colors. If you have an 8-bit (or less:-( )
display, you will not be able to see them all as distinct. Either form,
as well as upper, lower or mixed case can be used when constructing XColors.
- See Also:
- XColorTest
-
data
- The entire data structure: a list of color names, with the
R, G, and B values for each name.
-
name
- The default name (in case you print me after a failed construction)
-
XColor(int)
- Construct an XColor given a color value
-
XColor(String)
- Construct an XColor given a color value.
-
getColorList()
- Get the list of all available colors, as a pre-sorted array
-
toString()
- Provide a printable form of this color
-
XColorByName(String)
-
-
XColorByValue(int)
-
name
protected String name
- The default name (in case you print me after a failed construction)
data
protected static Setting data[]
- The entire data structure: a list of color names, with the
R, G, and B values for each name.
XColor
public XColor(String nm)
- Construct an XColor given a color value.
Constructs the Color with 0,0,0 (==black), then overrides "value"
in Color to be the RGB of the chosen color.
- Throws: IllegalArgumentException
- if the color can't be found.
XColor
public XColor(int val)
- Construct an XColor given a color value
XColorByName
public static int XColorByName(String nm)
XColorByValue
public static String XColorByValue(int val)
getColorList
public String[] getColorList()
- Get the list of all available colors, as a pre-sorted array
toString
public String toString()
- Provide a printable form of this color
- Overrides:
- toString in class Color