Commit 9fe1305e authored by Eric Tobias's avatar Eric Tobias

Added hex colour recognition to the textbox

parent a7e6378f
Pipeline #578 skipped
......@@ -95,15 +95,19 @@ public abstract class BaseTextBoxBuilder<B extends BaseTextBoxBuilder<B>> extend
centred = Boolean.parseBoolean(centredNode.getText());
}
Element colourNode = rootElement.getChild(Externalization.COLOUR_NODE);
try {
Element colourNode = rootElement.getChild(Externalization.COLOUR_NODE);
if (null != colourNode) {
Field field = Class.forName(Externalization.JAVA_AWT_COLOR_NAMESPACE).getField(colourNode.getText().toLowerCase());
colour = (Color) field.get(null);
}
} catch (ReflectiveOperationException roe) {
throw new BuildException("An error occured while trying to resolve the colour! The colour needs to mirror the java.awt.Color fields!", roe); //$NON-NLS-1$
try {
colour = Color.decode(colourNode.getText());
} catch (NumberFormatException nfe) {
throw new BuildException("An error occured while trying to resolve the colour! The colour needs to either mirror the java.awt.Color fields or represent a hexadecimal colour code!", nfe); //$NON-NLS-1$
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment