Fixed NullPointer in constructor of net.sourceforge.napkinlaf.NapkinLookAndFeel()
Brought to you by:
kcrca
Fixed NullPointer in constructor of net.sourceforge.napkinlaf.NapkinLookAndFeel() when run with newer OpenJdk versions:
public NapkinLookAndFeel() {
/*
* Default values are not initialised properly before the first
* JComponent is created in the application environment -- so if Napkin
* is employed by UIManager before that its overrideComponentDefaults()
* will not work as expected.
*
* Solution: create a JComponent to buy us security ;-)
*/
// Use getPackage() instead of property because property can fail on security check
Package sysPackage = Runtime.getRuntime().getClass().getPackage();
String sysVer = sysPackage.getSpecificationVersion();
if (null != sysVer && sysVer.startsWith("1.5")) {
new JLabel();
}
}