JGraph X 2.1.0.7


com.mxgraph.util
Class mxHtmlColor

java.lang.Object
  extended by com.mxgraph.util.mxHtmlColor

public class mxHtmlColor
extends Object

Contains various helper methods for use with mxGraph.


Field Summary
protected static HashMap<String,Color> htmlColors
          HTML color lookup table.
 
Constructor Summary
mxHtmlColor()
           
 
Method Summary
static String getHexColorString(Color color)
          Returns a hex representation for the given color.
static String hexString(Color color)
           
static Color parseColor(String str)
          Convert a string representing a 24/32bit hex color value into a Color object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

htmlColors

protected static HashMap<String,Color> htmlColors
HTML color lookup table. Supports the 147 CSS color names.

Constructor Detail

mxHtmlColor

public mxHtmlColor()
Method Detail

hexString

public static String hexString(Color color)

getHexColorString

public static String getHexColorString(Color color)
Returns a hex representation for the given color.

Parameters:
color - Color to return the hex string for.
Returns:
Returns a hex string for the given color.

parseColor

public static Color parseColor(String str)
                        throws NumberFormatException
Convert a string representing a 24/32bit hex color value into a Color object. All 147 CSS color names and none are also supported. None returns null. Examples of possible hex color values are: #C3D9FF, #6482B9 and #774400, but note that you do not include the "#" in the string passed in

Parameters:
str - the 24/32bit hex string value (ARGB)
Returns:
java.awt.Color (24bit RGB on JDK 1.1, 24/32bit ARGB on JDK1.2)
Throws:
NumberFormatException - if the specified string cannot be interpreted as a hexidecimal integer

JGraph X 2.1.0.7


Copyright (c) 2010 Gaudenz Alder. All rights reserved.