From 46a4e39d7689a8dab31689a0f9c089b0b8549d5e Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Mon, 13 Jun 2022 11:18:31 +0100 Subject: [PATCH] JAL-3416 Added some mac specific FlatLAF settings. Note this is not the default macOS LaF, this is only when -Dlaf=flat is set on a mac when running Jalview --- src/jalview/bin/Jalview.java | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index f4d340b..c0559db 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -45,9 +45,12 @@ import java.util.logging.ConsoleHandler; import java.util.logging.Level; import java.util.logging.Logger; +import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; +import com.formdev.flatlaf.FlatLightLaf; +import com.formdev.flatlaf.util.SystemInfo; import com.threerings.getdown.util.LaunchUtil; import groovy.lang.Binding; @@ -791,8 +794,8 @@ public class Jalview jalview.bin.Cache.getDefault("www.jalview.org", "https://www.jalview.org") + "/examples/exampleFile_2_7.jvp"); - if (file.equals( - "http://www.jalview.org/examples/exampleFile_2_3.jar") || file.equals( + if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar") + || file.equals( "http://www.jalview.org/examples/exampleFile_2_7.jar")) { file.replace("http:", "https:"); @@ -997,7 +1000,8 @@ public class Jalview if (info.getName() != null && nameStartsWith ? info.getName().toLowerCase(Locale.ROOT) .startsWith(name.toLowerCase(Locale.ROOT)) - : info.getName().toLowerCase(Locale.ROOT).equals(name.toLowerCase(Locale.ROOT))) + : info.getName().toLowerCase(Locale.ROOT) + .equals(name.toLowerCase(Locale.ROOT))) { className = info.getClassName(); break; @@ -1038,10 +1042,30 @@ public class Jalview "com.formdev.flatlaf.FlatLightLaf", false); if (set) { + if (Platform.isMac()) + { + System.setProperty("apple.laf.useScreenMenuBar", "true"); + System.setProperty("apple.awt.application.name", + ChannelProperties.getProperty("app_name")); + System.setProperty("apple.awt.application.appearance", "system"); + if (SystemInfo.isMacFullWindowContentSupported + && Desktop.desktop != null) + { + Desktop.desktop.getRootPane() + .putClientProperty("apple.awt.fullWindowContent", true); + Desktop.desktop.getRootPane() + .putClientProperty("apple.awt.transparentTitleBar", true); + } + + SwingUtilities.invokeLater(() -> { + FlatLightLaf.setup(); + }); + } + UIManager.put("TabbedPane.showTabSeparators", true); UIManager.put("TabbedPane.tabSeparatorsFullHeight", true); UIManager.put("TabbedPane.tabsOverlapBorder", true); - //UIManager.put("TabbedPane.hasFullBorder", true); + // UIManager.put("TabbedPane.hasFullBorder", true); UIManager.put("TabbedPane.tabLayoutPolicy", "scroll"); UIManager.put("TabbedPane.scrollButtonsPolicy", "asNeeded"); UIManager.put("TabbedPane.smoothScrolling", true); -- 1.7.10.2