/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
setTargetColour(fr.colourPanel.getBackground());
dialog.setVisible(true);
}
-
public UserDefinedColours(Component caller, Color col1, Frame alignframe)
{
+ this(caller, col1, alignframe, "Select Colour");
+ }
+ /**
+ * Makes a dialog to choose the colour
+ * @param caller - handles events
+ * @param col1 - original colour
+ * @param alignframe - the parent Frame for the dialog
+ * @param title - window title
+ */
+ public UserDefinedColours(Component caller, Color col1, Frame alignframe, String title)
+ {
this.caller = caller;
originalColour = col1;
- originalLabel = "Select Colour";
- setForDialog("Select Colour", alignframe);
+ originalLabel = title;
+ setForDialog(title, alignframe);
setTargetColour(col1);
dialog.setVisible(true);
}
okcancelPanel.setBounds(new Rectangle(0, 113, 400, 35));
frame.setTitle("User Defined Colours - " + label);
frame.setSize(420, 200);
- }
-
- void setForDialog(String title, Frame alignframe)
+ }
+
+ void setForDialog(String title, Container alignframe)
{
init();
frame.setVisible(false);
remove(buttonPanel);
- dialog = new Dialog(alignframe, title, true);
+ if (alignframe instanceof Frame)
+ {
+ dialog = new Dialog((Frame)alignframe, title, true);
+ }
+ else {
+// if (alignframe instanceof JVDialog){
+// // not 1.1 compatible!
+// dialog = new Dialog(((JVDialog)alignframe), title, true);
+// } else {
+ throw new Error("Unsupported owner for User Colour scheme dialog.");
+ }
dialog.add(this);
this.setSize(400, 123);
{
final Button button = new Button();
Color col = Color.white;
-
+ if (oldColourScheme!=null)
+ {
try
{
col = oldColourScheme.findColour(aa.charAt(0), -1);
} catch (Exception ex)
{
}
-
+ }
button.setBackground(col);
oldColours.addElement(col);
button.setLabel(label);
}
else if (caller instanceof FeatureRenderer)
{
- ((FeatureRenderer) caller).colourPanel.setBackground(getColor());
+ ((FeatureRenderer) caller).colourPanel.updateColor(getColor());
}
else if (caller instanceof FeatureColourChooser)
{
}
else if (caller instanceof FeatureRenderer)
{
- ((FeatureRenderer) caller).colourPanel
- .setBackground(originalColour);
+ ((FeatureRenderer) caller).colourPanel.updateColor(originalColour);
}
+ else if (caller instanceof FeatureColourChooser)
+ {
+ if (originalLabel.indexOf("inimum")>-1)
+ {
+ ((FeatureColourChooser) caller).minColour_actionPerformed(originalColour);
+ } else {
+ ((FeatureColourChooser) caller).maxColour_actionPerformed(originalColour);
+ }
+ }
if (dialog != null)
dialog.setVisible(false);