All Packages This Package Class Hierarchy Class Search Index
java.lang.Object | +----XColour
Summary |
public class XColour extends java.lang.Object { // Fields 2 private static final String colourFile; private static Hashtable hashColours; // Constructors 1 public XColour(); // Methods 6 public static Color Color(float, float, float); public static Color Color(int); public static Color Color(int, int, int); public static Color Color(String); private static void buildColourHashTable(); private static int readInt(BufferedReader) throws IOException; }
|
Creates a new Class that extends the Java Object. This means that we will inherit various data and methods from this class. This class just encapsulates the methods for returning different colours based upon different colour specifications.
|
See Also: Color
Fields |
· hashColours | Summary | Top |
private static Hashtable hashColours
Use this to hold the X11 colours read from the X11 Colour database.
See Also: Hashtable
· colourFile | Summary | Top |
private static final String colourFile
The constant String which holds the X11 Colour database filename. Note that this is a Unix thing!!
Constructors |
· XColour | Summary | Top |
public XColour()
Default constructor
Methods |
· readInt | Summary | Top |
private static int readInt(BufferedReader in) throws IOException
A private method used to read a single integer string from input.
Parameter Description in The I/O stream which holds the character making up the integer.
See Also: BufferedReader, read, IOException
· buildColourHashTable | Summary | Top |
private static void buildColourHashTable()
Build the colour database hashtable from the X11 database file.
Try to open the file. Remember we may not be on a Unix system.
Create a BufferedReader and continue to read lines, getting the (r,g,b) component and the colour name. These are put into the hashtable along with the name as the key.
The file is closed upon end of File.
See Also: Color, FileReader, BufferedReader, Hashtable
· Color | Summary | Top |
public static Color Color(int r, int g, int b)
Pretend we are the Color class with these parameters.
Parameter Description r The red integer component to the colour g The green integer component to the colour b The blue integer component to the colour
See Also: Color
· Color | Summary | Top |
public static Color Color(float r, float g, float b)
Pretend we are the Color class with these parameters.
Parameter Description r The red float component to the colour g The green float component to the colour b The blue float component to the colour
See Also: Color
· Color | Summary | Top |
public static Color Color(int rgb)
Pretend we are the Color class with these parameters.
Parameter Description rgb The red/green/blue integer component of the colour
See Also: Color
· Color | Summary | Top |
public static Color Color(String colourname)
Pretend we are the Color class with a colourname which we try to find in the X11 Colour database. Return that Color or null if we cannot retrieve it.
Parameter Description colourname the standard X11 Colour name.
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7