diff --git a/build.gradle b/build.gradle index acb979785..2debb1ea2 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ allprojects { targetCompatibility = 1.8 group = 'jgnash' - version = '2.36.1' + version = '2.36.2' project.ext { junitVersion = '5.3.1' diff --git a/changelog.adoc b/changelog.adoc index 4099db9b6..c600d17ec 100644 --- a/changelog.adoc +++ b/changelog.adoc @@ -27,6 +27,7 @@ * Choice dialog is not localized for some locales. Replace with an equivalent or submit upstream patch == Release 2.36.2 +* 02/17/2019 Fixed an issue preventing the old Swing UI from running with Java 11 (Swing). * 02/10/2019 Prevent an exception when importing odd OFX files using an XML declaration. (GitHub Issue #72) * 02/10/2019 Update to the latest Hibernate, Netty, and HikariCP dependencies. This improves compatibility with Java 9+. * 01/14/2019 jGnash would not start on a early access version of Java 8 (Swing, Fx, GitHub Issue #71) diff --git a/jgnash-swing/src/main/java/jgnash/ui/ThemeManager.java b/jgnash-swing/src/main/java/jgnash/ui/ThemeManager.java index 0a98344a7..112ceb541 100644 --- a/jgnash-swing/src/main/java/jgnash/ui/ThemeManager.java +++ b/jgnash-swing/src/main/java/jgnash/ui/ThemeManager.java @@ -38,6 +38,7 @@ import javax.swing.plaf.metal.MetalTheme; import javax.swing.plaf.nimbus.NimbusLookAndFeel; +import jgnash.resource.util.OS; import jgnash.ui.plaf.NimbusUtils; import jgnash.resource.util.ResourceUtils; @@ -67,11 +68,21 @@ public class ThemeManager { private static final long animationDuration; private static final String LF = "lookandfeel3"; private static final String THEME = "theme3"; + private static final String[] KNOWN = { "com.jgoodies.looks.plastic.PlasticLookAndFeel", + "com.jgoodies.looks.plastic.Plastic3DLookAndFeel", "com.jgoodies.looks.plastic.PlasticXPLookAndFeel", + "com.nilo.plaf.nimrod.NimRODLookAndFeel", "de.muntjak.tinylookandfeel.TinyLookAndFeel" }; + + private static final String[] KNOWN_WIN = { "com.jgoodies.looks.plastic.PlasticLookAndFeel", "com.jgoodies.looks.plastic.Plastic3DLookAndFeel", "com.jgoodies.looks.plastic.PlasticXPLookAndFeel", "com.jgoodies.looks.windows.WindowsLookAndFeel", "com.sun.java.swing.plaf.mac.MacLookAndFeel", "com.nilo.plaf.nimrod.NimRODLookAndFeel", "de.muntjak.tinylookandfeel.TinyLookAndFeel" }; + private static final String[] KNOWN_MAC = { "com.jgoodies.looks.plastic.PlasticLookAndFeel", + "com.jgoodies.looks.plastic.Plastic3DLookAndFeel", "com.jgoodies.looks.plastic.PlasticXPLookAndFeel", + "com.sun.java.swing.plaf.mac.MacLookAndFeel", "com.nilo.plaf.nimrod.NimRODLookAndFeel", + "de.muntjak.tinylookandfeel.TinyLookAndFeel" }; + static { animationDuration = AnimationConfigurationManager.getInstance().getTimelineDuration(); } @@ -183,7 +194,17 @@ JMenu buildLookAndFeelMenu() { } } - for (String lookAndFeel : KNOWN) { + final String[] lfs; + + if (OS.isSystemWindows()) { + lfs = KNOWN_WIN; + } else if (OS.isSystemOSX()) { + lfs = KNOWN_MAC; + } else { + lfs = KNOWN; + } + + for (final String lookAndFeel : lfs) { if (isLookAndFeelAvailable(lookAndFeel)) { lookAndFeels.add(lookAndFeel); } @@ -367,7 +388,7 @@ private static boolean isLookAndFeelAvailable(final String laf) { LookAndFeel newLAF = (LookAndFeel) lnfClass.getDeclaredConstructor().newInstance(); return newLAF.isSupportedLookAndFeel(); - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { // If ANYTHING bad happens, return false + } catch (final Exception e) { // If ANYTHING bad happens, return false Logger.getLogger(ThemeManager.class.getName()).log(Level.FINEST, e.getLocalizedMessage(), e); return false; }