Here you can find the source of hexToColor(String hex)
public static Color hexToColor(String hex)
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { public static Color hexToColor(String hex) { hex = hex.replace("#", ""); if (hex.length() == 6) { int r = Integer.valueOf(hex.substring(0, 2), 16); int g = Integer.valueOf(hex.substring(2, 4), 16); int b = Integer.valueOf(hex.substring(4, 6), 16); return new Color(r, g, b); }/*w w w . ja v a 2 s.c om*/ return Color.BLACK; } }