Class WebColors

All Implemented Interfaces:
Serializable, Cloneable, Map

class WebColors extends HashMap
This class is a HashMap that contains the names of colors as a key and the corresponding Color as value. (Source: Wikipedia http://en.wikipedia.org/wiki/Web_colors )
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • NAMES

      private static final WebColors NAMES
      HashMap containing all the names and corresponding color values.
  • Constructor Details

    • WebColors

      WebColors()
  • Method Details

    • getRGBColor

      static Color getRGBColor(String name) throws IllegalArgumentException
      Gives you a Color based on a name.
      Parameters:
      name - a name such as black, violet, cornflowerblue or #RGB or #RRGGBB or rgb(R,G,B)
      Returns:
      the corresponding Color object
      Throws:
      IllegalArgumentException - if the String isn't a know representation of a color.