From fa831484132498a5c7f9092a2066a730cbbd16ec Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 23 Apr 2010 10:53:24 +0000 Subject: [PATCH] 1.1 compatibility --- src/jalview/appletgui/FeatureColourChooser.java | 10 ++++++---- src/jalview/appletgui/UserDefinedColours.java | 22 +++++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/jalview/appletgui/FeatureColourChooser.java b/src/jalview/appletgui/FeatureColourChooser.java index e3ab8eb..6569186 100644 --- a/src/jalview/appletgui/FeatureColourChooser.java +++ b/src/jalview/appletgui/FeatureColourChooser.java @@ -31,7 +31,7 @@ public class FeatureColourChooser extends Panel implements ActionListener, AdjustmentListener, ItemListener, MouseListener { JVDialog frame; - + Frame owner; FeatureRenderer fr; FeatureSettings fs = null; // AlignmentPanel ap; @@ -96,7 +96,7 @@ public class FeatureColourChooser extends Panel implements colourFromLabel.addItemListener(this); slider.addAdjustmentListener(this); slider.addMouseListener(this); - Frame owner = (af!=null) ? af : fs.frame; + owner = (af!=null) ? af : fs.frame; frame = new JVDialog(owner,"Graduated Feature Colour for "+type,true,480,248); frame.setMainPanel(this); validate(); @@ -255,7 +255,7 @@ public class FeatureColourChooser extends Panel implements { if (newCol == null) { - UserDefinedColours udc = new UserDefinedColours(this,minColour.getBackground(), frame, "Select Colour for Minimum Value"); + UserDefinedColours udc = new UserDefinedColours(this,minColour.getBackground(),owner, "Select Colour for Minimum Value"); // frame.owner, } else { minColour.setBackground(newCol); minColour.repaint(); @@ -268,7 +268,9 @@ public class FeatureColourChooser extends Panel implements { if (newCol == null) { - UserDefinedColours udc = new UserDefinedColours(this,maxColour.getBackground(), frame, "Select Colour for Maximum Value");// this, "Select Colour for Maximum Value", maxColour.getBackground()); + + // UserDefinedColours udc = new UserDefinedColours(this, "Select Colour for Maximum Value",maxColour.getBackground(),true); + UserDefinedColours udc = new UserDefinedColours(this, maxColour.getBackground(), owner, "Select Colour for Maximum Value"); } else { maxColour.setBackground(newCol); maxColour.repaint(); diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index 5da1fbf..4f1ac38 100755 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -104,7 +104,14 @@ public class UserDefinedColours extends Panel implements ActionListener, { this(caller, col1, alignframe, "Select Colour"); } - public UserDefinedColours(Component caller, Color col1, Container alignframe, String title) + /** + * 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; @@ -127,8 +134,8 @@ public class UserDefinedColours extends Panel implements ActionListener, okcancelPanel.setBounds(new Rectangle(0, 113, 400, 35)); frame.setTitle("User Defined Colours - " + label); frame.setSize(420, 200); - } - + } + void setForDialog(String title, Container alignframe) { init(); @@ -138,10 +145,11 @@ public class UserDefinedColours extends Panel implements ActionListener, { dialog = new Dialog((Frame)alignframe, title, true); } - else - if (alignframe instanceof JVDialog){ - dialog = new Dialog(((JVDialog)alignframe), title, true); - } else { + 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."); } -- 1.7.10.2