X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=fd1783aacac7196b200044938bdc9eff73c04c5d;hp=fc4c8219b8bf456d4f941e7bd307040cc82c8344;hb=2ea4d68a1f9534dd2285b699862926395ad00f8b;hpb=a7634a9f5f5f691a7bff7bb05ca21a340aa2f834 diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index fc4c821..fd1783a 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -20,6 +20,7 @@ */ package jalview.bin; +import java.awt.Color; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; @@ -44,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 edu.stanford.ejalbert.launching.IBrowserLaunching; @@ -862,8 +866,8 @@ public class Jalview private static void setLookAndFeel() { - // property laf = "crossplatform", "system", "gtk", "metal", "nimbus" or - // "mac" + // property laf = "crossplatform", "system", "gtk", "metal", "nimbus", + // "mac" or "flat" // If not set (or chosen laf fails), use the normal SystemLaF and if on Mac, // try Quaqua/Vaqua. String lafProp = System.getProperty("laf"); @@ -915,6 +919,13 @@ public class Jalview Console.error("Could not set requested laf=" + laf); } break; + case "flat": + lafSet = setFlatLookAndFeel(); + if (!lafSet) + { + Console.error("Could not set requested laf=" + laf); + } + break; case "quaqua": lafSet = setQuaquaLookAndFeel(); if (!lafSet) @@ -1035,6 +1046,45 @@ public class Jalview "javax.swing.plaf.nimbus.NimbusLookAndFeel", false); } + private static boolean setFlatLookAndFeel() + { + boolean set = setSpecificLookAndFeel("flatlaf light", + "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.tabLayoutPolicy", "scroll"); + UIManager.put("TabbedPane.scrollButtonsPolicy", "asNeeded"); + UIManager.put("TabbedPane.smoothScrolling", true); + UIManager.put("TabbedPane.tabWidthMode", "compact"); + UIManager.put("TabbedPane.selectedBackground", Color.white); + } + return set; + } + private static boolean setQuaquaLookAndFeel() { return setSpecificLookAndFeel("quaqua",