Vector selectedButtons;\r
ColourSchemeI oldColourScheme;\r
JInternalFrame frame;\r
+ MCview.PDBCanvas pdbcanvas;\r
\r
/**\r
* Creates a new UserDefinedColours object.\r
makeButton("Gap", "-");\r
}\r
\r
+ public UserDefinedColours(MCview.PDBCanvas pdb, ColourSchemeI oldcs)\r
+ {\r
+ super();\r
+ frame = new JInternalFrame();\r
+ frame.setContentPane(this);\r
+ Desktop.addInternalFrame(frame, "User Defined Colours", 720, 370, true);\r
+ pdbcanvas = pdb;\r
+\r
+ if (System.getProperty("os.name").startsWith("Mac"))\r
+ {\r
+ frame.setSize(760, 370);\r
+ }\r
+\r
+ colorChooser.getSelectionModel().addChangeListener(this);\r
+\r
+ oldColourScheme = oldcs;\r
+\r
+ if (oldColourScheme instanceof UserColourScheme)\r
+ {\r
+ schemeName.setText( ( (UserColourScheme) oldColourScheme).getName());\r
+ }\r
+ for (int i = 0; i < 20; i++)\r
+ {\r
+ makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) +\r
+ "", ResidueProperties.aa[i]);\r
+ }\r
+\r
+ makeButton("B", "B");\r
+ makeButton("Z", "Z");\r
+ makeButton("X", "X");\r
+ makeButton("Gap", "-");\r
+ }\r
+\r
+\r
/**\r
* DOCUMENT ME!\r
*\r
seqGroup.cs = ucs;\r
ap.repaint();\r
}\r
- else\r
+ else if(ap!=null)\r
{\r
ap.alignFrame.changeColour(ucs);\r
}\r
+ else if(pdbcanvas!=null)\r
+ {\r
+ pdbcanvas.pdb.setColours(ucs);\r
+ pdbcanvas.updateSeqColours();\r
+ }\r
}\r
\r
UserColourScheme getSchemeFromGUI()\r
}\r
\r
UserColourScheme ucs = new UserColourScheme(newColours);\r
- ucs.setThreshold(0, ap.av.getIgnoreGapsConsensus());\r
+ if(ap!=null)\r
+ ucs.setThreshold(0, ap.av.getIgnoreGapsConsensus());\r
+\r
\r
return ucs;\r
}\r
*/\r
protected void cancelButton_actionPerformed(ActionEvent e)\r
{\r
+ if (ap != null)\r
+ {\r
if (seqGroup != null)\r
{\r
- seqGroup.cs = oldColourScheme;\r
+ seqGroup.cs = oldColourScheme;\r
}\r
- else\r
+ else if (ap != null)\r
{\r
- ap.av.setGlobalColourScheme(oldColourScheme);\r
+ ap.av.setGlobalColourScheme(oldColourScheme);\r
}\r
-\r
ap.repaint();\r
+ }\r
+\r
+ if(pdbcanvas!=null)\r
+ {\r
+ pdbcanvas.pdb.setColours(oldColourScheme);\r
+ }\r
\r
try\r
{\r