fix #60 Illegal reflective access operation on mac

This commit is contained in:
Bill Culp
2020-02-11 15:00:28 -08:00
parent 5b07941c4c
commit 3bf09ee731

View File

@@ -191,8 +191,15 @@ public abstract class FlatLaf
private BasicLookAndFeel getBase() {
if( base == null ) {
if( SystemInfo.IS_MAC ) {
base = (BasicLookAndFeel) UIManager.getLookAndFeel();
} else {
// use Mac Aqua LaF as base
String aquaLafClassName = "com.apple.laf.AquaLookAndFeel";
try {
base = (BasicLookAndFeel) Class.forName( aquaLafClassName ).getDeclaredConstructors()[0].newInstance();
} catch( Exception ex ) {
LOG.log( Level.SEVERE, "FlatLaf: Failed to initialize base look and feel '" + aquaLafClassName + "'.", ex );
throw new IllegalStateException();
}
} else
base = new MetalLookAndFeel();
}
}