<分区>
当您有 hexString #FFF080
并且您想将其转换为 org.eclipse.swt.graphics.Color
时,最好的方法是什么?
<分区>
当您有 hexString #FFF080
并且您想将其转换为 org.eclipse.swt.graphics.Color
时,最好的方法是什么?
最佳答案
或者简单地这样做:
public static Color decode(Display display, String hexString)
{
try
{
java.awt.Color c = java.awt.Color.decode(hexString);
return new Color(display, c.getRed(), c.getGreen(), c.getBlue());
}
catch(NumberFormatException e)
{
return null;
}
}
关于java - 如何将 hexString 转换为 SWT Color?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36196559/