X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=d1056bf42f10c30228b746512c49463c406499cc;hb=53fe06e7ae7a8c00ec902413391cea15362bdbf2;hp=9574e7e825c8f03acbe8d8110ad061e51496dd1e;hpb=7dcec14f584c3b4fc95e316e3d91e7d452889e5c;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 9574e7e..d1056bf 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; @@ -45,9 +46,12 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; +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; @@ -903,8 +907,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"); @@ -956,6 +960,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) @@ -1076,6 +1087,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",