From f8053a9aa8283bbfc441295be0a24f89a46655d0 Mon Sep 17 00:00:00 2001 From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04> Date: Mon, 13 Jul 2009 15:36:18 +0000 Subject: [PATCH] parse colour strings that are comma or colon separated rgb values git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@11348 ee4ac58c-ac51-4696-9907-e4b3aa274f04 --- uk/ac/sanger/artemis/plot/LineAttributes.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/uk/ac/sanger/artemis/plot/LineAttributes.java b/uk/ac/sanger/artemis/plot/LineAttributes.java index a04f29ca8..7d0e12d13 100644 --- a/uk/ac/sanger/artemis/plot/LineAttributes.java +++ b/uk/ac/sanger/artemis/plot/LineAttributes.java @@ -171,9 +171,10 @@ public class LineAttributes */ public static Color parse(String colourStr) { - if(colourStr.indexOf(":") > -1) + if(colourStr.indexOf(":") > -1 || + colourStr.indexOf(",") > -1) { - String colourStrs[] = colourStr.split(":"); + String colourStrs[] = colourStr.split("[:,]"); return new Color(Integer.parseInt(colourStrs[0]), Integer.parseInt(colourStrs[1]), Integer.parseInt(colourStrs[2])); @@ -184,7 +185,8 @@ public class LineAttributes colourStr = colourStr.toLowerCase(); if (colourStr.length() > 6) - throw new NumberFormatException("not a 24 bit representation of the color"); + throw new NumberFormatException(colourStr+ + " not a 24 bit representation of the color"); Color color = new Color( Integer.parseInt( colourStr , 16 ) ); return color; @@ -302,6 +304,7 @@ public class LineAttributes } } + /** * Renderer for the JComboBox to define different line styles. */ -- GitLab