JAL-3058 refactored raising JColorChooser for JS compatibility
[jalview.git] / src / jalview / gui / Preferences.java
index 019b29e..aeac55f 100755 (executable)
@@ -23,6 +23,7 @@ package jalview.gui;
 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
 import jalview.bin.Cache;
 import jalview.gui.Help.HelpId;
+import jalview.gui.JalviewColourChooser.ColourChooserListener;
 import jalview.gui.StructureViewer.ViewerType;
 import jalview.io.FileFormatI;
 import jalview.io.JalviewFileChooser;
@@ -1047,27 +1048,17 @@ public class Preferences extends GPreferences
   @Override
   public void minColour_actionPerformed(JPanel panel)
   {
-    Color col = JColorChooser.showDialog(this,
+    JalviewColourChooser.showColourChooser(this,
             MessageManager.getString("label.select_colour_minimum_value"),
-            minColour.getBackground());
-    if (col != null)
-    {
-      panel.setBackground(col);
-    }
-    panel.repaint();
+            panel);
   }
 
   @Override
   public void maxColour_actionPerformed(JPanel panel)
   {
-    Color col = JColorChooser.showDialog(this,
+    JalviewColourChooser.showColourChooser(this,
             MessageManager.getString("label.select_colour_maximum_value"),
-            maxColour.getBackground());
-    if (col != null)
-    {
-      panel.setBackground(col);
-    }
-    panel.repaint();
+            panel);
   }
 
   @Override
@@ -1075,28 +1066,18 @@ public class Preferences extends GPreferences
   {
     if (!useLegacyGap.isSelected())
     {
-      Color col = JColorChooser.showDialog(this,
+      JalviewColourChooser.showColourChooser(this,
               MessageManager.getString("label.select_gap_colour"),
-              gapColour.getBackground());
-      if (col != null)
-      {
-        gap.setBackground(col);
-      }
-      gap.repaint();
+              gap);
     }
   }
 
   @Override
   public void hiddenColour_actionPerformed(JPanel hidden)
   {
-    Color col = JColorChooser.showDialog(this,
+    JalviewColourChooser.showColourChooser(this,
             MessageManager.getString("label.select_hidden_colour"),
-            hiddenColour.getBackground());
-    if (col != null)
-    {
-      hidden.setBackground(col);
-    }
-    hidden.repaint();
+            hidden);
   }
 
   @Override