X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationColourChooser.java;h=ad013f5bb1a90478c99967c3ce79a70c6c862b24;hb=4160e6f1fa6aa45849153cce5794faa93e3a19c4;hp=7ed178b4bdde183a24ec7b9f71966ec35767d20f;hpb=37668aa43e535d99d5745880cef6eb0aeb1dd422;p=jalview.git diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 7ed178b..ad013f5 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -24,6 +24,7 @@ import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.GraphLine; import jalview.datamodel.SequenceGroup; +import jalview.gui.JalviewColourChooser.ColourChooserListener; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.ColourSchemeI; import jalview.util.MessageManager; @@ -42,7 +43,6 @@ import java.util.Vector; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JCheckBox; -import javax.swing.JColorChooser; import javax.swing.JComboBox; import javax.swing.JInternalFrame; import javax.swing.JLayeredPane; @@ -61,9 +61,9 @@ public class AnnotationColourChooser extends AnnotationRowFilter private JCheckBox useOriginalColours = new JCheckBox(); - private JPanel minColour = new JPanel(); + JPanel minColour = new JPanel(); - private JPanel maxColour = new JPanel(); + JPanel maxColour = new JPanel(); private JCheckBox thresholdIsMin = new JCheckBox(); @@ -173,7 +173,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter { if (minColour.isEnabled()) { - minColour_actionPerformed(); + showColourChooser(minColour, "label.select_colour_minimum_value"); } } }); @@ -188,7 +188,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter { if (maxColour.isEnabled()) { - maxColour_actionPerformed(); + showColourChooser(maxColour, "label.select_colour_maximum_value"); } } }); @@ -287,30 +287,21 @@ public class AnnotationColourChooser extends AnnotationRowFilter Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red)); } - public void minColour_actionPerformed() + protected void showColourChooser(JPanel colourPanel, String titleKey) { - Color col = JColorChooser.showDialog(this, - MessageManager.getString("label.select_colour_minimum_value"), - minColour.getBackground()); - if (col != null) + String ttl = MessageManager.getString(titleKey); + ColourChooserListener listener = new ColourChooserListener() { - minColour.setBackground(col); - } - minColour.repaint(); - updateView(); - } - - public void maxColour_actionPerformed() - { - Color col = JColorChooser.showDialog(this, - MessageManager.getString("label.select_colour_maximum_value"), - maxColour.getBackground()); - if (col != null) - { - maxColour.setBackground(col); - } - maxColour.repaint(); - updateView(); + @Override + public void colourSelected(Color c) + { + colourPanel.setBackground(c); + colourPanel.repaint(); + updateView(); + } + }; + JalviewColourChooser.showColourChooser(Desktop.getDesktop(), ttl, + colourPanel.getBackground(), listener); } @Override