JAL-2976 fixed bad equivalence check and implemented belt-and-braces check for quaqua...
authorJim Procter <jprocter@issues.jalview.org>
Wed, 9 May 2018 09:39:19 +0000 (10:39 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 9 May 2018 09:39:19 +0000 (10:39 +0100)
src/jalview/bin/Jalview.java

index 287096d..30620a1 100755 (executable)
@@ -61,6 +61,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Vector;
 
+import javax.swing.LookAndFeel;
 import javax.swing.UIManager;
 
 import groovy.lang.Binding;
@@ -280,25 +281,32 @@ public class Jalview
     }
     if (Platform.isAMac())
     {
+
+      LookAndFeel lookAndFeel = ch.randelshofer.quaqua.QuaquaManager
+              .getLookAndFeel();
       System.setProperty("com.apple.mrj.application.apple.menu.about.name",
               "Jalview");
       System.setProperty("apple.laf.useScreenMenuBar", "true");
-      try
-      {
-        UIManager.setLookAndFeel(
-                ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel());
-      } catch (Throwable e)
+      if (lookAndFeel != null)
       {
-        System.err.println(
-                "Failed to set QuaQua look and feel: " + e.toString());
+        try
+        {
+          UIManager.setLookAndFeel(lookAndFeel);
+        } catch (Throwable e)
+        {
+          System.err.println(
+                  "Failed to set QuaQua look and feel: " + e.toString());
+        }
       }
-      if (!ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel()
-              .equals(UIManager.getLookAndFeel()))
+      if (lookAndFeel == null || !(lookAndFeel.getClass()
+              .isAssignableFrom(UIManager.getLookAndFeel().getClass()))
+              || !UIManager.getLookAndFeel().getClass().toString()
+                      .toLowerCase().contains("quaqua"))
       {
         try
         {
           System.err.println(
-                  "Quaqua LaF not available. Using VAqua(4).");
+                  "Quaqua LaF not available on this plaform. Using VAqua(4).\nSee https://issues.jalview.org/browse/JAL-2976");
           UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel");
         } catch (Throwable e)
         {