Here you can find the source of toColor(Node n)
public static Color toColor(Node n)
//package com.java2s; import java.awt.Color; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static Color toColor(Node n) { if (!n.getNodeName().equals("color")) { throw new IllegalArgumentException(n.getNodeName()); }//from w ww . ja v a 2 s. c o m NamedNodeMap map = n.getAttributes(); String s = map.getNamedItem("name").getNodeValue(); if (s.equals("white")) { return Color.WHITE; } else if (s.equals("green")) { return Color.GREEN; } else if (s.equals("pink")) { return Color.PINK; } else if (s.equals("cyan")) { return Color.CYAN; } else if (s.equals("yellow")) { return Color.YELLOW; } else { return Color.WHITE; } } }