JAL-3032 Dialogs Color picker -- untested commit
authorhansonr <hansonr@stolaf.edu>
Wed, 27 Jun 2018 10:24:43 +0000 (11:24 +0100)
committerhansonr <hansonr@stolaf.edu>
Wed, 27 Jun 2018 10:24:43 +0000 (11:24 +0100)
src/jalview/gui/FeatureRenderer.java

index 46f574e..3b9c622 100644 (file)
@@ -194,14 +194,13 @@ public class FeatureRenderer
       {
         if (fcol.isSimpleColour())
         {
-          Color col = JColorChooser.showDialog(Desktop.desktop,
+          // BH 2018 JavaScript-compatible color dialog
+          Desktop.desktop.dialogData = new Object[] {
+              "label.select_feature_colour", this, mainPanel, colour };
+          Desktop.desktop
+                  .onDialogReturn(JColorChooser.showDialog(Desktop.desktop,
                   MessageManager.getString("label.select_feature_colour"),
-                  fcol.getColour());
-          if (col != null)
-          {
-            fcol = new FeatureColour(col);
-            updateColourButton(mainPanel, colour, fcol);
-          }
+                          fcol.getColour()));
         }
         else
         {
@@ -500,6 +499,17 @@ public class FeatureRenderer
     return true;
   }
 
+  void processColorDialog(Color col)
+  {
+    JPanel mainPanel = (JPanel) Desktop.desktop.dialogData[2];
+    JLabel colour = (JLabel) Desktop.desktop.dialogData[3];
+    if (col != null)
+    {
+      fcol = new FeatureColour(col);
+      updateColourButton(mainPanel, colour, fcol);
+    }
+  }
+
   /**
    * Show a warning message if the entered type is one that is currently hidden
    *