From f9cb557b667c61cab5a939b3c87506cdc7d8d26b Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 1 May 2020 11:57:37 +0100 Subject: [PATCH] JAL-3608 Added java builtin NimbusLookAndFeel option 'nimbus' --- src/jalview/bin/Jalview.java | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) 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) -- 1.7.10.2