JAL-3027 Avoid FlatLAF Desktop class is JalviewJS
[jalview.git] / src / jalview / jbgui / APQHandlers.java
index e18ec44..5e04b14 100644 (file)
@@ -26,13 +26,16 @@ import javax.swing.JOptionPane;
 import com.formdev.flatlaf.extras.FlatDesktop;
 
 import jalview.util.MessageManager;
+import jalview.util.Platform;
 
 public class APQHandlers
 {
-  protected static boolean setAPQHandlers = false;
-
   public static boolean setAPQHandlers(GDesktop desktop)
   {
+    if (Platform.isJS())
+    {
+      return false;
+    }
     FlatDesktop.setAboutHandler(() -> {
       desktop.aboutMenuItem_actionPerformed(null);
     });
@@ -81,10 +84,8 @@ public class APQHandlers
         response.cancelQuit();
       }
     });
-
-    setAPQHandlers = true;
-
-    return setAPQHandlers;
+    // if we got to here, no exceptions occurred when we set the handlers.
+    return true;
   }
 
 }