From 0b8133635dc649fb7710b9390a718c8f27a7f276 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 9 May 2018 10:39:19 +0100 Subject: [PATCH] JAL-2976 fixed bad equivalence check and implemented belt-and-braces check for quaqua in class name string of look and feel to decide when to fallback to violetlib-Aqua. --- src/jalview/bin/Jalview.java | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 287096d..30620a1 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -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) { -- 1.7.10.2