Skip to content

Commit

Permalink
Fixed an issue preventing the old Swing UI from running with Java 11 …
Browse files Browse the repository at this point in the history
…(Swing).
  • Loading branch information
ccavanaugh committed Feb 17, 2019
1 parent be582be commit eb74e66
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ allprojects {
targetCompatibility = 1.8

group = 'jgnash'
version = '2.36.1'
version = '2.36.2'

project.ext {
junitVersion = '5.3.1'
Expand Down
1 change: 1 addition & 0 deletions changelog.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 23 additions & 2 deletions jgnash-swing/src/main/java/jgnash/ui/ThemeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit eb74e66

Please sign in to comment.