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.
-
ColorStore()
-
-
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.
-
getClosestColorName(Color)
- Given a Color, return the name of the color listed in the
ColorStore closest to that color.
-
getColor(String)
- Given the name of a color, return the Color corresponding to it.
-
getColorList()
- Returns the list of Colors named in the ColorStore.
-
getColorName(Color)
- Returns the name of a color.
-
getDefaultColorStore()
- Returns a reference to the single global instance of ColorStore.
ColorStore
public ColorStore()
getDefaultColorStore
public static ColorStore getDefaultColorStore()
- Returns a reference to the single global instance of ColorStore.
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).
getColor
public Color getColor(String name)
- Given the name of a color, return the Color corresponding to it.
getClosestColorName
public String getClosestColorName(Color c)
- Given a Color, return the name of the color listed in the
ColorStore closest to that color.
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.
getColorList
public String[] getColorList()
- Returns the list of Colors named in the ColorStore.
All Packages Class Hierarchy This Package Previous Next Index