ColourSchemeI oldColourScheme;\r
Frame frame;\r
MCview.AppletPDBCanvas pdbcanvas;\r
+ FeatureSettings featureSettings;\r
+ String feature;\r
+ Color originalFeatureCol;\r
\r
int R = 0, G = 0, B = 0;\r
\r
init();\r
}\r
\r
+ public UserDefinedColours(FeatureSettings featureSettings,\r
+ String feature,\r
+ Color col)\r
+ {\r
+ this.featureSettings = featureSettings;\r
+ this.feature = feature;\r
+ init();\r
+ remove(buttonPanel);\r
+ originalFeatureCol = col;\r
+ setTargetColour(col);\r
+\r
+ okcancelPanel.setBounds(new Rectangle(0, 113, 400, 35));\r
+ frame.setTitle("User Defined Colours - "+feature);\r
+ frame.setSize(420, 200);\r
+ }\r
+\r
public void actionPerformed(ActionEvent evt)\r
{\r
if(evt.getSource()==okButton)\r
}\r
}\r
\r
- public void colourButtonPressed(MouseEvent e)\r
+ void setTargetColour(Color col)\r
{\r
- selectedButton = (Button) e.getSource();\r
- Color col = selectedButton.getBackground();\r
R = col.getRed();\r
G = col.getGreen();\r
B = col.getBlue();\r
rText.setText(R + "");\r
gText.setText(G + "");\r
bText.setText(B + "");\r
-\r
colourChanged();\r
}\r
\r
+ public void colourButtonPressed(MouseEvent e)\r
+ {\r
+ selectedButton = (Button) e.getSource();\r
+ setTargetColour(selectedButton.getBackground());\r
+ }\r
+\r
void makeButton(String label, String aa)\r
{\r
final Button button = new Button();\r
\r
protected void applyButton_actionPerformed()\r
{\r
+ if (featureSettings != null)\r
+ {\r
+ featureSettings.setUserColour(feature, new Color(R,G,B));\r
+ return;\r
+ }\r
+\r
Color[] newColours = new Color[24];\r
for (int i = 0; i < 24; i++)\r
{\r
\r
protected void cancelButton_actionPerformed()\r
{\r
+ if(featureSettings!=null)\r
+ {\r
+ featureSettings.setUserColour(feature, originalFeatureCol);\r
+ frame.setVisible(false);\r
+ return;\r
+ }\r
\r
Color[] newColours = new Color[24];\r
for (int i = 0; i < 24; i++)\r
\r
protected Panel buttonPanel = new Panel();\r
protected GridLayout gridLayout = new GridLayout();\r
- Panel jPanel2 = new Panel();\r
+ Panel okcancelPanel = new Panel();\r
protected Button okButton = new Button();\r
protected Button applyButton = new Button();\r
protected Button cancelButton = new Button();\r
cancelButton.setLabel("Cancel");\r
cancelButton.addActionListener(this);\r
this.setBackground(new Color(212, 208, 223));\r
- jPanel2.setBounds(new Rectangle(0, 265, 400, 35));\r
+ okcancelPanel.setBounds(new Rectangle(0, 265, 400, 35));\r
buttonPanel.setBounds(new Rectangle(0, 123, 400, 142));\r
rScroller.setMaximum(256);\r
rScroller.setMinimum(0);\r
bText.addActionListener(this);\r
target.setBackground(Color.black);\r
target.setBounds(new Rectangle(229, 26, 134, 79));\r
- this.add(jPanel2, null);\r
- jPanel2.add(okButton, null);\r
- jPanel2.add(applyButton, null);\r
- jPanel2.add(cancelButton, null);\r
+ this.add(okcancelPanel, null);\r
+ okcancelPanel.add(okButton, null);\r
+ okcancelPanel.add(applyButton, null);\r
+ okcancelPanel.add(cancelButton, null);\r
this.add(buttonPanel, null);\r
this.add(target, null);\r
this.add(gScroller);\r