diff --git a/src/java/org/lwjgl/util/applet/AppletLoader.java b/src/java/org/lwjgl/util/applet/AppletLoader.java index 31cd79d4..01402ec1 100644 --- a/src/java/org/lwjgl/util/applet/AppletLoader.java +++ b/src/java/org/lwjgl/util/applet/AppletLoader.java @@ -114,9 +114,9 @@ import sun.security.util.SecurityConstants; *
  • al_linux64 - [String] If specifed it will be used instead of al_linux on 64bit linux systems.
  • *
  • al_linux32 - [String] If specifed it will be used instead of al_linux on 32bit linux systems.
  • * *

    * @author kappaOne @@ -266,11 +266,11 @@ public class AppletLoader extends Applet implements Runnable, AppletStub { prependHost = getBooleanParameter("al_prepend_host", true); // get colors of applet - bgColor = getColor("al_bgcolor", Color.white); + bgColor = getColor("boxbgcolor", Color.white); setBackground(bgColor); - fgColor = getColor("al_fgcolor", Color.black); - errorColor = getColor("al_errorcolor", Color.red); + fgColor = getColor("boxfgcolor", Color.black); + errorColor = getColor("boxerrorcolor", Color.red); // load logos logo = getImage(getParameter("al_logo")); @@ -1318,12 +1318,39 @@ public class AppletLoader extends Applet implements Runnable, AppletStub { * @param defaultColor Default color to use if no color to load * @return Color to use */ - protected Color getColor(String color, Color defaultColor) { - String param_color = getParameter(color); - if (param_color != null) { - return new Color(Integer.parseInt(param_color, 16)); - } - return defaultColor; + protected Color getColor(String param, Color defaultColor) { + String color = getParameter(param); + + if (color == null) return defaultColor; + + // Check if RGB format + if (color.indexOf(",") != -1) { + StringTokenizer st = new StringTokenizer(color, ","); + + // We've got three components for the color + try { + return new Color(Integer.parseInt(st.nextToken().trim()), + Integer.parseInt(st.nextToken().trim()), + Integer.parseInt(st.nextToken().trim())); + } catch (Exception e) { + // failed to parse + return defaultColor; + } + } + + // Check & decode if the color is in hexadecimal color format (i.e. #808000) + try { + return Color.decode(color); + } catch (NumberFormatException e) { + // ignore exception + } + + // Get the color by name if it exists + try { + return (Color)Color.class.getField(color).get(null); + } catch (Exception e) { + return defaultColor; + } } /**