From: Ben Soares Date: Fri, 1 May 2020 10:57:37 +0000 (+0100) Subject: JAL-3608 Added java builtin NimbusLookAndFeel option 'nimbus' X-Git-Tag: Develop-2_11_2_0-d20201215~24^2~16^2^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f9cb557b667c61cab5a939b3c87506cdc7d8d26b;p=jalview.git JAL-3608 Added java builtin NimbusLookAndFeel option 'nimbus' --- diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index cc3a4a2..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; @@ -400,6 +401,12 @@ public class Jalview 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) @@ -899,6 +906,12 @@ public class Jalview 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) @@ -915,6 +928,34 @@ public class Jalview 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)