X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=ca850eb28245744ed46b23806495c7f355858d58;hb=c6df3928336440918d23b4e7cb579f134e2f48dd;hp=1ae101455749d3c4b88c1c81048c380bdb12c9d8;hpb=d85279450741df748b662ca0e7757a489b8c6d01;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 1ae1014..ca850eb 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -20,8 +20,7 @@ */ package jalview.bin; -import java.util.Locale; - +import java.awt.Color; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; @@ -39,15 +38,19 @@ import java.security.PermissionCollection; import java.security.Permissions; import java.security.Policy; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Vector; 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:"); @@ -853,8 +856,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"); @@ -906,6 +909,13 @@ public class Jalview Cache.log.error("Could not set requested laf=" + laf); } break; + case "flat": + lafSet = setFlatLookAndFeel(); + if (!lafSet) + { + Cache.log.error("Could not set requested laf=" + laf); + } + break; case "quaqua": lafSet = setQuaquaLookAndFeel(); if (!lafSet) @@ -990,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; @@ -1025,6 +1036,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",