Update AppearanceHandler.java

This commit is contained in:
ChrisMickelson 2017-02-01 21:54:32 -05:00 committed by GitHub
parent 6379729670
commit f6ccc7f264

View File

@ -51,7 +51,14 @@ class AppearanceHandler extends AbstractElementHandler {
int red = Integer.parseInt(attributes.get("red"));
int green = Integer.parseInt(attributes.get("green"));
int blue = Integer.parseInt(attributes.get("blue"));
builder.setPaint(new Color(red, green, blue));
int alpha = 255;//set default
// add a test if "alpha" was added to the XML / backwards compatibility
String a = attributes.get("alpha");
if (a != null){
// "alpha" string was present so load the value
alpha = Integer.parseInt(a);
}
builder.setPaint(new Color(red, green, blue, alpha));
return;
}
if ("shine".equals(element)) {
@ -96,4 +103,4 @@ class AppearanceHandler extends AbstractElementHandler {
super.endHandler(element, attributes, content, warnings);
}
}
}