private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        //Set window properties
        this.setLocationRelativeTo(null);
        this.setIconImage(Resources.getImageResource("icon.png").getImage());
        popupDialog.setIconImage(Resources.getImageResource("icon.png").getImage());
        UpdateLogoLabel.setIcon(Resources.getImageResource("update.png"));
        popupDialogImageLabel.setIcon(Resources.getImageResource("alert.png"));
        
        SimpleSwingWorker worker = new SimpleSwingWorker() {
            
            @Override
            protected void task() {
                
                //Copy updates
                copyDirectoryAndBackUpOldFiles(new File("./launcherpatch"), new File(".."));
                
                //Load version config
                JSONObject versionConfig;
                try {
                    versionConfig = (JSONObject)JSONValue.parse(FileUtils.readFileToString(new File("./version.json")));
                } catch (IOException ex) {
                    showPopupDialog("Warning:  The version file could not be updated!  This may cause problems.");
                    System.exit(0);
                    return;
                }
                
                //Get new version from arguments
                String newVersion = "0";
                for (String arg : Arguments) {
                    if (arg.startsWith("--version=")) {
                        newVersion = arg.substring(10);
                        break;
                    }
                }
                
                //Save new version file
                try {
                    versionConfig.put("moddleversion", newVersion);
                    FileUtils.writeStringToFile(new File("./version.json"), versionConfig.toJSONString());
                } catch (IOException ex) {
                    showPopupDialog("Warning:  The version file could not be updated!  This may cause problems.");
                    System.exit(0);
                    return;
                }
                
                //Start Moddle
                try {
                    ProcessBuilder moddle = new ProcessBuilder(new String[] { "javaw.exe", "-jar", "\"" + new File("../Moddle.jar").getCanonicalPath() + "\"" });
                    moddle.directory(new File(".."));
                    moddle.start();
                } catch (IOException ex) {
                    try {
                        ProcessBuilder moddle = new ProcessBuilder(new String[] { "javaw.exe", "-jar", "\"../Moddle.jar\"" });
                        moddle.directory(new File(".."));
                        moddle.start();
                    } catch (IOException ex2) { showPopupDialog("Failed to start Moddle!"); }
                }
                
                //Exit
                System.exit(0);
                
            }
            
        };
        worker.execute();
    }//GEN-LAST:event_formWindowOpened