package com.weebly.marlookup.main;

import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;



public class Starter {

	private static final String updateURL = "http://pastebin.com/raw.php?i=xKFXUfy5";

	public static void main(String[] args) {
		System.out.println("Starting Up. (c) by Marenthyu");
		System.out.println("Checking for Update...");
		
		
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException | InstantiationException
				| IllegalAccessException | UnsupportedLookAndFeelException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		

	 MainWindow programm = new MainWindow();

	}
	
	public void	checkForUpdate() {
		try {
			String newestVersion = URLConnectionReader.getText(updateURL);
			if (newestVersion.equals(MainWindow.VERSION)) {
				System.out.println("Version is up to date!");
			} else {
				System.out.println("Update found!");
				int selection = JOptionPane.showConfirmDialog(null, "Update to version "+newestVersion+" found, your Version is: "+MainWindow.VERSION+"\nDo you want to update now?","Update found!",JOptionPane.YES_NO_OPTION);
				System.out.println(selection);
				if (selection == 0) {
					this.openUrl("http://marlookup.weebly.com");
					System.exit(0);
				}
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}

@@ -31,16 +31,84 @@
 ain;%0D%0A%0D%0A
+import java.io.IOException;%0D%0Aimport java.net.URISyntaxException;%0D%0A%0D%0A
 import j
@@ -484,20 +484,135 @@
 .%22);%0D%0A%09%09
-%0D%0A%09%09
+checkForUpdate();%0D%0A%09%09System.out.println(%22Update Check Complete.%22);%0D%0A%09%09%0D%0A%09%09System.out.println(%22Setting LookAndFeel...%22);
 %0D%0A%09%09try 
@@ -887,16 +887,68 @@
 %0A%09%09%7D%0D%0A%09%09
+System.out.println(%22Done. Loading Up Main Window.%22);
 %0D%0A%0D%0A%09 Ma
@@ -1003,16 +1003,23 @@
 %09public 
+static 
 void%09che
@@ -1555,13 +1555,8 @@
 %09%09%09%09
-this.
 open
@@ -1726,14 +1726,410 @@
 %09%09%7D%0D%0A%09%7D%0D
+%0A%09public static void openUrl(String url) throws IOException, URISyntaxException %7B%0D%0A%09%09  if(java.awt.Desktop.isDesktopSupported() ) %7B%0D%0A%09%09        java.awt.Desktop desktop = java.awt.Desktop.getDesktop();%0D%0A%0D%0A%09%09        if(desktop.isSupported(java.awt.Desktop.Action.BROWSE) ) %7B%0D%0A%09%09          java.net.URI uri = new java.net.URI(url);%0D%0A%09%09              desktop.browse(uri);%0D%0A%09%09        %7D%0D%0A%09%09      %7D %0D%0A%09%09%7D%0D
 %0A%0D%0A%7D%0D%0A

Update Check and Dev output added.