package cloud.swiftnode.ksecurity.module.kgui;

import cloud.swiftnode.ksecurity.module.kgui.abstraction.gui.KAlert;
import cloud.swiftnode.ksecurity.util.Lang;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.awt.*;

/**
 * Created by Junhyeong Lim on 2017-02-04.
 */
public class KFX extends Application {
    private static Stage stage;

    public static void start() {
        launch(KFX.class);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        int width = 500;
        int height = 350;

        stage = primaryStage;
        FXMLLoader.setDefaultClassLoader(getClass().getClassLoader());
        Parent root = FXMLLoader.load(getClass().getResource("/Main.fxml"));
        primaryStage.setOnCloseRequest(event -> hideStage(primaryStage));
        primaryStage.setTitle("K-Security 이벤트 로그");
        primaryStage.setScene(new Scene(root, width, height));
        primaryStage.setMinWidth(width);
        primaryStage.setMinHeight(height);
        primaryStage.show();
        Platform.setImplicitExit(false);
    }

    private void hideStage(Stage stage) {
        if (SystemTray.isSupported()) {
            stage.hide();
            new KAlert().setContextText(Lang.CLOSE_ALERT.builder().flatBuild())
                    .show();
        }
    }

    public static Stage getStage() {
        return stage;
    }
}

@@ -45,121 +45,8 @@
 i;%0A%0A
-import cloud.swiftnode.ksecurity.module.kgui.abstraction.gui.KAlert;%0Aimport cloud.swiftnode.ksecurity.util.Lang;%0A
 impo
@@ -80,16 +80,16 @@
 cation;%0A
+
 import j
@@ -234,28 +234,8 @@
 e;%0A%0A
-import java.awt.*;%0A%0A
 /**%0A
@@ -777,31 +777,93 @@
  -%3E 
-hideStage(primaryStage)
+%7B%0A            primaryStage.setIconified(true);%0A            event.consume();%0A        %7D
 );%0A 
@@ -1081,32 +1081,32 @@
 ryStage.show();%0A
+
         Platform
@@ -1141,242 +1141,8 @@
  %7D%0A%0A
-    private void hideStage(Stage stage) %7B%0A        if (SystemTray.isSupported()) %7B%0A            stage.hide();%0A            new KAlert().setContextText(Lang.CLOSE_ALERT.builder().flatBuild())%0A                    .show();%0A        %7D%0A    %7D%0A%0A
     

Fix GUI error