【发布时间】:2011-01-21 08:26:17
【问题描述】:
this article 建议您可以使用 Color c = Color.decode("FF0096"); 但是这可以理解抛出异常
Caused by: java.lang.NumberFormatException: For input string: "FF0096"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.valueOf(Integer.java:528)
at java.lang.Integer.decode(Integer.java:958)
at java.awt.Color.decode(Color.java:707)
将“#FF0096”或“FF0096”格式的字符串转换为java awt Color的最佳方法是什么?
【问题讨论】: