From 614526a57b61c771de369d422407eb993454bd72 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 6 Jan 2023 17:36:42 +0000 Subject: [PATCH] JAL-3416 More explicit setting of FlatLaf macOS theme --- src/jalview/bin/Jalview.java | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 2fad096..0ec9889 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -49,6 +49,7 @@ import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; import com.formdev.flatlaf.FlatLightLaf; import com.formdev.flatlaf.util.SystemInfo; @@ -1123,9 +1124,29 @@ public class Jalview private static boolean setFlatLookAndFeel() { - boolean set = setSpecificLookAndFeel("flatlaf light", - Platform.isMac() ? "com.formdev.flatlaf.themes.FlatMacLightLaf" : - "com.formdev.flatlaf.FlatLightLaf", false); + boolean set = false; + if (Platform.isMac()) { + try + { + UIManager.setLookAndFeel("com.formdev.flatlaf.themes.FlatMacLightLaf"); + set = true; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) + { + Console.debug("Exception loading FlatMacLightLaf", e); + } + } + if (!set) { + try + { + UIManager.setLookAndFeel("com.formdev.flatlaf.FlatLightLaf"); + set = true; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) + { + Console.debug("Exception loading FlatLightLaf", e); + } + } if (set) { if (Platform.isMac()) -- 1.7.10.2