/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.schemes;\r
\r
import java.awt.*;\r
\r
+public class UserColourScheme\r
+ extends ResidueColourScheme\r
+{\r
+ protected String schemeName;\r
\r
-public class UserColourScheme extends ResidueColourScheme {\r
- public UserColourScheme(Color[] newColors) {\r
- colors = newColors;\r
+ public UserColourScheme(String colour)\r
+ {\r
+ Color col = null;\r
+ try{\r
+ int value = Integer.parseInt(colour, 16);\r
+ col = new Color(value);\r
}\r
+ catch(NumberFormatException ex){}\r
\r
- public Color[] getColours() {\r
- return colors;\r
+ if(col==null)\r
+ col = ColourSchemeProperty.getAWTColorFromName(colour);\r
+\r
+ if(col==null)\r
+ {try{\r
+ java.util.StringTokenizer st = new java.util.StringTokenizer(colour, ",");\r
+ int r = Integer.parseInt( st.nextToken() );\r
+ int g = Integer.parseInt( st.nextToken() );\r
+ int b = Integer.parseInt( st.nextToken() );\r
+ col = new Color(r,g,b);\r
+ }catch(Exception ex){}\r
+ }\r
+\r
+ if(col==null)\r
+ {\r
+ System.out.println("Unknown colour!! "+colour);\r
}\r
+\r
+ colors = new Color[24];\r
+ for(int i=0; i<24; i++)\r
+ colors[i] = col;\r
+ }\r
+\r
+ public UserColourScheme(Color[] newColors)\r
+ {\r
+ colors = newColors;\r
+ }\r
+\r
+ public Color[] getColours()\r
+ {\r
+ return colors;\r
+ }\r
+\r
+ public void setName(String name)\r
+ {\r
+ schemeName = name;\r
+ }\r
+ public String getName()\r
+ {\r
+ return schemeName;\r
+ }\r
}\r