Class sunsoft.jws.visual.rt.type.ColorStore
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sunsoft.jws.visual.rt.type.ColorStore

java.lang.Object
   |
   +----sunsoft.jws.visual.rt.type.ColorStore

public class ColorStore
extends Object
Stores colors by name and rgb value. Names are always stored in lower case, and searches are done after converting the search key into lower case. Two hashtables are used so colors can be accessed efficiently either by color or name.

Constructor Index

 o ColorStore()

Method Index

 o add(Color, String)
Adds the color/name pair to the color store is it is not already there and returns the name of the color.
 o getClosestColorName(Color)
Given a Color, return the name of the color listed in the ColorStore closest to that color.
 o getColor(String)
Given the name of a color, return the Color corresponding to it.
 o getColorList()
Returns the list of Colors named in the ColorStore.
 o getColorName(Color)
Returns the name of a color.
 o getDefaultColorStore()
Returns a reference to the single global instance of ColorStore.

Constructors

 o ColorStore
  public ColorStore()

Methods

 o getDefaultColorStore
  public static ColorStore getDefaultColorStore()
Returns a reference to the single global instance of ColorStore.
 o getColorName
  public String getColorName(Color c)
Returns the name of a color. If the color name is not in our table, return #RRGGBB (a string of hex numbers).
 o getColor
  public Color getColor(String name)
Given the name of a color, return the Color corresponding to it.
 o getClosestColorName
  public String getClosestColorName(Color c)
Given a Color, return the name of the color listed in the ColorStore closest to that color.
 o add
  public String add(Color c,
                    String name)
Adds the color/name pair to the color store is it is not already there and returns the name of the color. If the color is already registered, the previous name of the color is returned.
 o getColorList
  public String[] getColorList()
Returns the list of Colors named in the ColorStore.

All Packages  Class Hierarchy  This Package  Previous  Next  Index