Skip to content
Snippets Groups Projects
Commit f8053a9a authored by tjc's avatar tjc
Browse files

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
parent eb6220dd
No related branches found
No related tags found
No related merge requests found
...@@ -171,9 +171,10 @@ public class LineAttributes ...@@ -171,9 +171,10 @@ public class LineAttributes
*/ */
public static Color parse(String colourStr) 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]), return new Color(Integer.parseInt(colourStrs[0]),
Integer.parseInt(colourStrs[1]), Integer.parseInt(colourStrs[1]),
Integer.parseInt(colourStrs[2])); Integer.parseInt(colourStrs[2]));
...@@ -184,7 +185,8 @@ public class LineAttributes ...@@ -184,7 +185,8 @@ public class LineAttributes
colourStr = colourStr.toLowerCase(); colourStr = colourStr.toLowerCase();
if (colourStr.length() > 6) 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 ) ); Color color = new Color( Integer.parseInt( colourStr , 16 ) );
return color; return color;
...@@ -302,6 +304,7 @@ public class LineAttributes ...@@ -302,6 +304,7 @@ public class LineAttributes
} }
} }
/** /**
* Renderer for the JComboBox to define different line styles. * Renderer for the JComboBox to define different line styles.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment