public void userDefinedColour_actionPerformed(ActionEvent e)\r
{\r
JInternalFrame frame = new JInternalFrame();\r
- UserDefinedColours chooser = new UserDefinedColours( frame, viewport );\r
+ UserDefinedColours chooser = new UserDefinedColours( frame, alignPanel, null);\r
frame.setContentPane(chooser);\r
Desktop.addInternalFrame(frame,"User defined colours", 450,540 );\r
frame.setResizable(false);\r
package jalview.gui;\r
\r
import jalview.jbgui.GUserDefinedColours;\r
+import jalview.datamodel.*;\r
import javax.swing.*;\r
import java.awt.*;\r
import java.awt.event.*;\r
public class UserDefinedColours extends GUserDefinedColours implements ChangeListener\r
{\r
\r
- AlignViewport av;\r
- ColourSchemeI colourScheme;\r
+ AlignmentPanel ap;\r
+ SequenceGroup seqGroup;\r
JButton selectedButton;\r
Vector oldColours = new Vector();\r
JInternalFrame frame;\r
\r
- public UserDefinedColours(JInternalFrame f, AlignViewport av)\r
+ public UserDefinedColours(JInternalFrame f, AlignmentPanel ap, SequenceGroup sg)\r
{\r
super();\r
colorChooser.getSelectionModel().addChangeListener(this);\r
- this.av = av;\r
+ this.ap = ap;\r
frame = f;\r
- colourScheme = av.getGlobalColourScheme();\r
+ seqGroup = sg;\r
\r
for(int i=0; i<20; i++)\r
makeButton(ResidueProperties.aa2Triplet.get( ResidueProperties.aa[i] )+"", ResidueProperties.aa[i]);\r
void makeButton(String label, String aa)\r
{\r
final JButton button = new JButton();\r
- button.setBackground( colourScheme.findColour(null,aa,-1,null) );\r
- oldColours.addElement( colourScheme.findColour(null,aa,-1,null) );\r
+ Color col = Color.white;\r
+ ColourSchemeI cs = null;\r
+ if(seqGroup!=null)\r
+ cs = seqGroup.cs;\r
+ else\r
+ cs = ap.av.getGlobalColourScheme();\r
+\r
+ if(cs!=null)\r
+ col = cs.findColour(null, aa, -1, null);\r
+\r
+ button.setBackground( col );\r
+ oldColours.addElement( col );\r
button.setText( label );\r
button.setFont(new java.awt.Font("Verdana", 1, 10));\r
button.addMouseListener(new java.awt.event.MouseAdapter()\r
\r
ucs.setThreshold(0);\r
ucs.setColourScheme( newColours );\r
- av.setGlobalColourScheme( ucs );\r
+\r
+ if(seqGroup!=null)\r
+ seqGroup.cs = ucs;\r
+ else\r
+ ap.av.setGlobalColourScheme(ucs);\r
+\r
+ ap.RefreshPanels();\r
}\r
\r
protected void loadbutton_actionPerformed(ActionEvent e)\r
}\r
\r
ucs.setColourScheme( newColours );\r
- av.setGlobalColourScheme( ucs );\r
+ if (seqGroup != null)\r
+ seqGroup.cs = ucs;\r
+ else\r
+ ap.av.setGlobalColourScheme(ucs);\r
+\r
+ ap.RefreshPanels();\r
\r
}\r
\r