X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=d1056bf42f10c30228b746512c49463c406499cc;hb=53fe06e7ae7a8c00ec902413391cea15362bdbf2;hp=357f0e43753a4375226ed55c0153ff6d32a60a43;hpb=853cdaf827241e4bf51d9a1fef32a395cb72cf45;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 357f0e4..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; @@ -44,11 +45,16 @@ import java.util.logging.ConsoleHandler; 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; import groovy.lang.Binding; import groovy.util.GroovyScriptEngine; import jalview.ext.so.SequenceOntology; @@ -71,6 +77,7 @@ import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; import jalview.util.ChannelProperties; import jalview.util.HttpUtils; +import jalview.util.LaunchUtils; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.jws2.Jws2Discoverer; @@ -428,6 +435,35 @@ public class Jalview * @j2sIgnore */ { + + /** + * Check to see that the JVM version being run is suitable for the Java + * version this Jalview was compiled for. Popup a warning if not. + */ + if (!LaunchUtils.checkJavaVersion()) + { + Console.warn("The Java version being used (Java " + + LaunchUtils.getJavaVersion() + + ") may lead to problems. This installation of Jalview should be used with Java " + + LaunchUtils.getJavaCompileVersion() + "."); + + if (!LaunchUtils + .getBooleanUserPreference("IGNORE_JVM_WARNING_POPUP")) + { + Object[] options = { + MessageManager.getString("label.continue") }; + JOptionPane.showOptionDialog(null, + MessageManager.formatMessage( + "warning.wrong_jvm_version_message", + LaunchUtils.getJavaVersion(), + LaunchUtils.getJavaCompileVersion()), + MessageManager + .getString("warning.wrong_jvm_version_title"), + JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, + null, options, options[0]); + } + } + if (!aparser.contains("nowebservicediscovery")) { desktop.startServiceDiscovery(); @@ -482,13 +518,23 @@ public class Jalview } if (!aparser.contains("nohtmltemplates") - || Cache.getProperty("NOHTMLTEMPLATES") == null) + || Cache.getProperty("NOHTMLTEMPLATES") == null) { BioJsHTMLOutput.updateBioJS(); } } } + // Check if JVM and compile version might cause problems and log if it + // might. + if (headless && !Platform.isJS() && !LaunchUtils.checkJavaVersion()) + { + Console.warn("The Java version being used (Java " + + LaunchUtils.getJavaVersion() + + ") may lead to problems. This installation of Jalview should be used with Java " + + LaunchUtils.getJavaCompileVersion() + "."); + } + // Move any new getdown-launcher-new.jar into place over old // getdown-launcher.jar String appdirString = System.getProperty("getdownappdir"); @@ -861,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"); @@ -914,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) @@ -1034,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", @@ -1121,7 +1213,8 @@ public class Jalview @Override public void run() { - Console.debug("Initialising googletracker for usage stats."); + Console.debug( + "Initialising googletracker for usage stats."); Cache.initGoogleTracker(); Console.debug("Tracking enabled."); }