package app.lsgui.gui;

import java.io.IOException;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

public class MainWindow extends Application {

    private static FXMLLoader loader;

    @Override
    public void init() {
        loader = new FXMLLoader();
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        try {
            Parent root = loader.load(getClass().getResourceAsStream(("/MainWindow.fxml")));
            Scene scene = new Scene(root);

            //scene.getStylesheets().add(getClass().getResource("lightStyle.css").toString());

            primaryStage.setTitle("Livestreamer GUI v3.0");
            //primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/assets/icon.jpg")));
            primaryStage.setScene(scene);
            primaryStage.show();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}

@@ -47,16 +47,128 @@
 eption;%0D
+%0Aimport java.lang.Thread.UncaughtExceptionHandler;%0D%0A%0D%0Aimport org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D
 %0A%0D%0Aimpor
@@ -198,24 +198,61 @@
 plication;%0D%0A
+import javafx.application.Platform;%0D%0A
 import javaf
@@ -441,20 +441,99 @@
 on %7B%0D%0A%0D%0A
-    
+%09private static final Logger LOGGER = LoggerFactory.getLogger(MainWindow.class);%0D%0A%09
 private 
@@ -557,28 +557,25 @@
  loader;%0D%0A%0D%0A
-    
+%09
 @Override%0D%0A 
@@ -565,36 +565,33 @@
 %0D%0A%0D%0A%09@Override%0D%0A
-    
+%09
 public void init
@@ -596,24 +596,18 @@
 it() %7B%0D%0A
-        
+%09%09
 loader =
@@ -630,36 +630,356 @@
 );%0D%0A
-    %7D%0D%0A%0D%0A    @Override%0D%0A    
+%09%09Thread.currentThread().setUncaughtExceptionHandler(new UncaughtExceptionHandler() %7B%0D%0A%0D%0A%09%09%09public void uncaughtException(Thread t, Throwable e) %7B%0D%0A%09%09%09%09LOGGER.error(%22Uncaught Exception on JavaFX Thread%22, e);%0D%0A%09%09%09%09LOGGER.error(%22Exiting JavaFX Thread...%22);%0D%0A%0D%0A%09%09%09%09Platform.exit();%0D%0A%09%09%09%7D%0D%0A%09%09%7D);%0D%0A%09%09Platform.setImplicitExit(false);%0D%0A%09%7D%0D%0A%0D%0A%09@Override%0D%0A%09
 publ
@@ -1036,35 +1036,20 @@
  %7B%0D%0A
-        try %7B%0D%0A            
+%09%09try %7B%0D%0A%09%09%09
 Pare
@@ -1126,28 +1126,19 @@
 l%22)));%0D%0A
-            
+%09%09%09
 Scene sc
@@ -1163,30 +1163,19 @@
 ot);%0D%0A%0D%0A
-            //
+%09%09%09
 scene.ge
@@ -1217,16 +1217,17 @@
 source(%22
+/
 lightSty
@@ -1251,28 +1251,19 @@
 ());%0D%0A%0D%0A
-            
+%09%09%09
 primaryS
@@ -1307,22 +1307,11 @@
 );%0D%0A
-            //
+%09%09%09
 prim
@@ -1381,15 +1381,8 @@
 m(%22/
-assets/
 icon
@@ -1388,36 +1388,27 @@
 n.jpg%22)));%0D%0A
-            
+%09%09%09
 primaryStage
@@ -1426,28 +1426,19 @@
 cene);%0D%0A
-            
+%09%09%09
 primaryS
@@ -1451,24 +1451,18 @@
 how();%0D%0A
-        
+%09%09
 %7D catch 
@@ -1484,20 +1484,11 @@
  %7B%0D%0A
-            
+%09%09%09
 e.pr
@@ -1509,25 +1509,16 @@
 );%0D%0A
-        
+%09%09
 %7D%0D%0A%0D%0A
-    
+%09
 %7D%0D%0A%0D

add uncaughtexceptionhandler to javafx thread