git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dedbb25
)
Can be used for user features
author
amwaterhouse
<Andrew Waterhouse>
Thu, 16 Mar 2006 15:14:09 +0000
(15:14 +0000)
committer
amwaterhouse
<Andrew Waterhouse>
Thu, 16 Mar 2006 15:14:09 +0000
(15:14 +0000)
src/jalview/appletgui/UserDefinedColours.java
patch
|
blob
|
history
diff --git
a/src/jalview/appletgui/UserDefinedColours.java
b/src/jalview/appletgui/UserDefinedColours.java
index
b092601
..
6544993
100755
(executable)
--- a/
src/jalview/appletgui/UserDefinedColours.java
+++ b/
src/jalview/appletgui/UserDefinedColours.java
@@
-38,6
+38,9
@@
public class UserDefinedColours
ColourSchemeI oldColourScheme;
\r
Frame frame;
\r
MCview.AppletPDBCanvas pdbcanvas;
\r
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
\r
int R = 0, G = 0, B = 0;
\r
\r
@@
-70,6
+73,22
@@
public class UserDefinedColours
init();
\r
}
\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
public void actionPerformed(ActionEvent evt)
\r
{
\r
if(evt.getSource()==okButton)
\r
@@
-200,10
+219,8
@@
public class UserDefinedColours
}
\r
}
\r
\r
}
\r
}
\r
\r
- public void colourButtonPressed(MouseEvent e)
\r
+ void setTargetColour(Color col)
\r
{
\r
{
\r
- selectedButton = (Button) e.getSource();
\r
- Color col = selectedButton.getBackground();
\r
R = col.getRed();
\r
G = col.getGreen();
\r
B = col.getBlue();
\r
R = col.getRed();
\r
G = col.getGreen();
\r
B = col.getBlue();
\r
@@
-213,10
+230,15
@@
public class UserDefinedColours
rText.setText(R + "");
\r
gText.setText(G + "");
\r
bText.setText(B + "");
\r
rText.setText(R + "");
\r
gText.setText(G + "");
\r
bText.setText(B + "");
\r
-
\r
colourChanged();
\r
}
\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
void makeButton(String label, String aa)
\r
{
\r
final Button button = new Button();
\r
@@
-253,6
+275,12
@@
public class UserDefinedColours
\r
protected void applyButton_actionPerformed()
\r
{
\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
Color[] newColours = new Color[24];
\r
for (int i = 0; i < 24; i++)
\r
{
\r
@@
-287,6
+315,12
@@
public class UserDefinedColours
\r
protected void cancelButton_actionPerformed()
\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
Color[] newColours = new Color[24];
\r
for (int i = 0; i < 24; i++)
\r
@@
-320,7
+354,7
@@
public class UserDefinedColours
\r
protected Panel buttonPanel = new Panel();
\r
protected GridLayout gridLayout = new GridLayout();
\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
protected Button okButton = new Button();
\r
protected Button applyButton = new Button();
\r
protected Button cancelButton = new Button();
\r
@@
-350,7
+384,7
@@
public class UserDefinedColours
cancelButton.setLabel("Cancel");
\r
cancelButton.addActionListener(this);
\r
this.setBackground(new Color(212, 208, 223));
\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
buttonPanel.setBounds(new Rectangle(0, 123, 400, 142));
\r
rScroller.setMaximum(256);
\r
rScroller.setMinimum(0);
\r
@@
-396,10
+430,10
@@
public class UserDefinedColours
bText.addActionListener(this);
\r
target.setBackground(Color.black);
\r
target.setBounds(new Rectangle(229, 26, 134, 79));
\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
this.add(buttonPanel, null);
\r
this.add(target, null);
\r
this.add(gScroller);
\r