MCview.AppletPDBCanvas pdbcanvas;\r
AppletJmol jmol;\r
\r
+ Dialog dialog;\r
Object caller;\r
String originalLabel;\r
Color originalColour;\r
init();\r
}\r
\r
+ public UserDefinedColours(FeatureRenderer fr, Frame alignframe)\r
+ {\r
+ caller = fr;\r
+ originalColour = fr.colourPanel.getBackground();\r
+ originalLabel = "Feature Colour";\r
+ setTargetColour(fr.colourPanel.getBackground());\r
+\r
+ setForDialog("Select Feature Colour", alignframe);\r
+ }\r
+\r
+ public UserDefinedColours(Component caller,\r
+ Color col1,\r
+ Frame alignframe)\r
+ {\r
+ this.caller = caller;\r
+ originalColour = col1;\r
+ originalLabel = "Select Colour";\r
+ setTargetColour(col1);\r
+\r
+ setForDialog("Select Colour", alignframe);\r
+ }\r
+\r
+\r
public UserDefinedColours(Object caller,\r
String label,\r
Color colour)\r
frame.setSize(420, 200);\r
}\r
\r
+ void setForDialog(String title, Frame alignframe)\r
+ {\r
+ init();\r
+ frame.setVisible(false);\r
+ remove(buttonPanel);\r
+ dialog = new Dialog(alignframe, title, true);\r
+\r
+ dialog.add(this);\r
+ this.setSize(400,123);\r
+ okcancelPanel.setBounds(new Rectangle(0, 123, 400, 35));\r
+ int height = 160 + alignframe.getInsets().top + getInsets().bottom;\r
+ int width = 400;\r
+\r
+ dialog.setBounds(alignframe.getBounds().x\r
+ + (alignframe.getSize().width - width) / 2,\r
+ alignframe.getBounds().y\r
+ + (alignframe.getSize().height - height) / 2,\r
+ width, height);\r
+\r
+ dialog.show();\r
+ }\r
+\r
public void actionPerformed(ActionEvent evt)\r
{\r
if (evt.getSource() == okButton)\r
protected void okButton_actionPerformed()\r
{\r
applyButton_actionPerformed();\r
+ if (dialog != null)\r
+ dialog.setVisible(false);\r
+\r
frame.setVisible(false);\r
}\r
\r
+ public Color getColor()\r
+ {\r
+ return new Color(R, G, B);\r
+ }\r
+\r
protected void applyButton_actionPerformed()\r
{\r
if (caller != null)\r
if (caller instanceof FeatureSettings)\r
{\r
( (FeatureSettings) caller).setUserColour\r
- (originalLabel, new Color(R, G, B));\r
+ (originalLabel, getColor());\r
}\r
else if (caller instanceof AnnotationColourChooser)\r
{\r
if (originalLabel.equals("Min Colour"))\r
{\r
( (AnnotationColourChooser) caller).minColour_actionPerformed\r
- (new Color(R, G, B));\r
+ (getColor());\r
}\r
else\r
{\r
( (AnnotationColourChooser) caller).maxColour_actionPerformed\r
- (new Color(R, G, B));\r
+ (getColor());\r
}\r
}\r
+ else if(caller instanceof FeatureRenderer)\r
+ {\r
+ ((FeatureRenderer)caller).colourPanel.setBackground(getColor());\r
+ }\r
+\r
return;\r
}\r
\r
(originalColour);\r
}\r
}\r
+ else if (caller instanceof FeatureRenderer)\r
+ {\r
+ ( (FeatureRenderer) caller).colourPanel.setBackground(originalColour);\r
+\r
+ }\r
+\r
+ if(dialog!=null)\r
+ dialog.setVisible(false);\r
+\r
frame.setVisible(false);\r
return;\r
}\r