Here you can find the source of stringToColor(String colorString)
public static java.awt.Color stringToColor(String colorString)
//package com.java2s; //License from project: BSD License import java.awt.Color; public class Main { public static java.awt.Color stringToColor(String colorString) { try {/* w w w . j av a2s . c om*/ String colorClean; if (colorString.length() > 0 && colorString.charAt(0) == '#') colorClean = colorString.substring(1); else colorClean = colorString; int ncolor = Integer.parseInt(colorClean, 16); return new Color(ncolor); } catch (NumberFormatException nfe) { //unrecognized return null; } } }