Skip to content

Commit db04a57

Browse files
committed
fixes Color.getColor(name)
1 parent 908d8b7 commit db04a57

File tree

1 file changed

+7
-6
lines changed
  • sources/net.sf.j2s.java.core/src/java/awt

1 file changed

+7
-6
lines changed

sources/net.sf.j2s.java.core/src/java/awt/Color.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -785,12 +785,13 @@ public static Color getColor(String nm) {
785785
* @since JDK1.0
786786
*/
787787
public static Color getColor(String nm, Color v) {
788-
Integer intval = Integer.getInteger(nm);
789-
if (intval == null) {
790-
return v;
791-
}
792-
int i = intval.intValue();
793-
return new Color((i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF);
788+
// SwingJS does not support System.getProperty for colors.
789+
try {
790+
int i = Integer.decode(nm);
791+
return new Color((i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF);
792+
} catch (NumberFormatException e) {
793+
return v;
794+
}
794795
}
795796

796797
/**

0 commit comments

Comments
 (0)