Class ColorKey

java.lang.Object
  extended by ColorKey

public class ColorKey
extends java.lang.Object


Constructor Summary
ColorKey(java.util.List<java.lang.String> l)
          Construct a color key for the specified list of labels.
 
Method Summary
 void drawColorKey(GenDraw gd, double x, double y, double w, double h)
          Draw a color key in the specified rectangle
 java.awt.Color getColor(int i)
          Get the ith color.
 java.awt.Color getColor(java.lang.String s)
          Gets color associated with string s.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorKey

public ColorKey(java.util.List<java.lang.String> l)
Construct a color key for the specified list of labels.

Parameters:
l - A list of labels for the colors.
Method Detail

getColor

public java.awt.Color getColor(java.lang.String s)
Gets color associated with string s.

Parameters:
s - a string
Returns:
the color associated with string s, if one exists. The default color, otherwise.

getColor

public java.awt.Color getColor(int i)
Get the ith color.

Parameters:
i -
Returns:
the ith color, if it exists. The default color otherwise

drawColorKey

public void drawColorKey(GenDraw gd,
                         double x,
                         double y,
                         double w,
                         double h)
Draw a color key in the specified rectangle

Parameters:
gd - canvas to draw on.
(x,y) - lower left corner of the rectangle
w - width of the rectangle
h - height of the rectangle

main

public static void main(java.lang.String[] args)