如何用十六进制的数生成颜色对象
如题,例如用 #FFFFFF 生成一个 Color 对象
[解决办法]
public Color getColor(String col){
if(col.length()==7){
return new Color(Integer.parseInt(col.substring(1,3),16),Integer.parseInt(col.substring(3,5),16),Integer.parseInt(col.substring(5,7),16));
}
return null;
}