package nightcode;

import java.awt.SplashScreen;

import java.lang.reflect.Method;

/**
 * This class handles loading of Nightcode namespaces while the splash image
 * is displayed on the screen. See entry point main() method in this class. How
 * it works:
 * 0. Assumes the splash screen is loaded (see project.clj - :manifest entry)
 * 1. Loads nightcode.core/-main using reflection (it takes time)
 * 2. Closes splash screen
 * 3. Invokes nightcode.core/-main
 * See: http://docs.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html
 * See (creating animated loader image): http://preloaders.net/en/search/text
 */
public class Main {

    private Method loadNightcodeMain() throws Exception {
        final String cn = "nightcode.core";
        Class<?> clazz = Class.forName(cn);
        if (clazz == null) {
            throw new RuntimeException("Cannot load class " + cn);
        }
        Method m = clazz.getMethod("main", String[].class);
        if (m == null) {
            throw new RuntimeException("Cannot obtain method 'main'");
        }
        return m;
    }

    private void invokeNightcodeMain(Method m, String[] args) throws Exception {
        m.invoke(null, (Object) args);
    }

    private void init(String[] args) throws Exception {
        final SplashScreen splash = SplashScreen.getSplashScreen();
        if (splash == null) {
            System.err.println("Cannot launch splash screen. Proceeding.");
        }
        Method m = loadNightcodeMain();
        if (splash != null) {
            splash.close();
        }
        invokeNightcodeMain(m, args);
    }

    public static void main(String[] args) throws Exception {
        new Main().init(args);
    }

}
@@ -43,17 +43,16 @@
 Screen;%0A
-%0A
 import j
@@ -75,16 +75,45 @@
 .Method;
+%0Aimport java.util.Properties;
 %0A%0A/**%0A *
@@ -1684,32 +1684,612 @@
 ows Exception %7B%0A
+        Properties props = System.getProperties();%0A        // properties to make font rendering smoother on Linux+OracleJVM/OpenJDK%0A        // should make no difference on other OSes and JVMs%0A        // set properties only if the user has not overidden them%0A        if (props.getProperty(%22awt.useSystemAAFontSettings%22) == null%0A                && props.getProperty(%22sun.java2d.xrender%22) == null) %7B%0A            props.setProperty(%22awt.useSystemAAFontSettings%22, %22lcd%22);%0A            props.setProperty(%22sun.java2d.xrender%22, %22true%22);%0A        %7D%0A        // initialize and launch Nightcode%0A
         new Main

fix #73 by setting specific properties before Nightcode init