org.tigris.gef.util
Class ColorFactory

java.lang.Object
  extended byorg.tigris.gef.util.ColorFactory

public class ColorFactory
extends java.lang.Object

A flyweight factory class used to get color instances. This only creates new instances of a Color if required. Previous instances are cached.

Since:
0.11.1 10-May-2005

Method Summary
static java.awt.Color getColor(java.lang.String colorDescr)
          A flyweight factory method for reusing the same Color value multiple times.
static java.awt.Color getColor(java.lang.String colorDescr, java.awt.Color defaultColor)
          A flyweight factory method for reusing the same Color value multiple times.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getColor

public static java.awt.Color getColor(java.lang.String colorDescr,
                                      java.awt.Color defaultColor)
A flyweight factory method for reusing the same Color value multiple times.

Parameters:
colorDescr - A string of RGB values seperated by space or a color name recognised by PGML (later to include SVG)
defaultColor - a color to return if the color description can't be interpretted.
Returns:
the equivilent Color

getColor

public static java.awt.Color getColor(java.lang.String colorDescr)
A flyweight factory method for reusing the same Color value multiple times.

Parameters:
colorDescr - A string of RGB values seperated by space or a color name recognised by PGML (later to include SVG)
Returns:
the equivilent Color