   import java.awt.Color;
   import java.io.*;
   import java.util.Scanner;
   import java.util.Vector;
	import java.util.Hashtable;

/**
 * A class that can be used to retrieve Color objects
 * by name (using the W3C names defined in
 * http://www.w3.org/TR/2003/CR-css3-color-20030514/ )
 */
    public class ColorFinder
   {
  
        private Hashtable<String,Color>  colors;  
  
   
    /**
     * Default Constructor
     */
       public ColorFinder() throws IOException
      {
         Color          value;       
         int            blue, green, red;       
         Scanner        in;
         String         key;
       
         colors = new Hashtable<String,Color>();
       
         in = new Scanner(new File("colors.txt"));
      
         for (int i=0; in.hasNext(); i++)
         {
            key       = in.next();
            red       = in.nextInt();
            green     = in.nextInt();
            blue      = in.nextInt();
            value     = new Color(red, green, blue);          
         
//            names.add(key);
//            colors.add(value);          
              colors.put (key,value);  
	         }
      }
   
   
    /**
     * Get the Color with the given name/description
     *
     * @param   description  The name/description of the Color
     * @return               The Color (or null if no such name exists)
     */
       public Color getColor(String description)
      {
         Color          result;

          result = colors.get(description);
       
         return result;       
      }// end getColor
    
   }// end class
