X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=992ca0143f7b922d85bd30620e8a404b6727f7d1;hb=f9cb557b667c61cab5a939b3c87506cdc7d8d26b;hp=5c026fded8a1e0fc892be2385dc4ba930013e943;hpb=8ac246459db21ac8c6a07834b815261ee961fb9a;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 5c026fd..992ca01 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -45,6 +45,7 @@ import java.util.logging.Logger; import javax.swing.LookAndFeel; import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; import com.threerings.getdown.util.LaunchUtil; @@ -367,7 +368,7 @@ public class Jalview desktop = null; - // property laf = "crossplatform", "system" or "mac" + // property laf = "crossplatform", "system", "gtk", "metal" or "mac" // If not set (or chosen laf fails), use the normal SystemLaF and if on Mac, // try Quaqua/Vaqua. String laf = System.getProperty("laf", "none"); @@ -388,6 +389,24 @@ public class Jalview System.err.println("Could not set requested laf=" + laf); } break; + case "gtk": + lafSet = setGtkLookAndFeel(); + { + System.err.println("Could not set requested laf=" + laf); + } + break; + case "metal": + lafSet = setMetalLookAndFeel(); + { + System.err.println("Could not set requested laf=" + laf); + } + break; + case "nimbus": + lafSet = setNimbusLookAndFeel(); + { + System.err.println("Could not set requested laf=" + laf); + } + break; case "mac": lafSet = setMacLookAndFeel(); if (!lafSet) @@ -403,6 +422,9 @@ public class Jalview if (!lafSet) { setSystemLookAndFeel(); + if (Platform.isLinux() && ! Platform.isJS()) { + setMetalLookAndFeel(); + } if (Platform.isAMacAndNotJS()) { setMacLookAndFeel(); @@ -878,6 +900,72 @@ public class Jalview return set; } + private static boolean setGtkLookAndFeel() + { + boolean set = false; + String laf = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; + try + { + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if (info.getName() != null && info.getName().startsWith("Gtk")) { + laf = info.getClassName(); + break; + } + } + UIManager.setLookAndFeel(laf); + set = true; + } catch (Exception ex) + { + System.err.println("Unexpected Look and Feel Exception"); + ex.printStackTrace(); + } + return set; + } + + private static boolean setMetalLookAndFeel() + { + boolean set = false; + String laf = "javax.swing.plaf.metal.MetalLookAndFeel"; + try + { + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if (info.getName() != null && info.getName().equals("Metal")) { + laf = info.getClassName(); + break; + } + } + UIManager.setLookAndFeel(laf); + set = true; + } catch (Exception ex) + { + System.err.println("Unexpected Look and Feel Exception"); + ex.printStackTrace(); + } + return set; + } + + private static boolean setNimbusLookAndFeel() + { + boolean set = false; + String laf = "javax.swing.plaf.nimbus.NimbusLookAndFeel"; + try + { + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if (info.getName() != null && info.getName().equals("Nimbus")) { + laf = info.getClassName(); + break; + } + } + UIManager.setLookAndFeel(laf); + set = true; + } catch (Exception ex) + { + System.err.println("Unexpected Look and Feel Exception"); + ex.printStackTrace(); + } + return set; + } + private static boolean setMacLookAndFeel() { boolean set = false;