Visualiser Closes All threads on exit now.
- Added override for exiting the Visualiser which closes all threads: such as the TCP connection. #story[782]
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
package seng302;
|
package seng302;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
public class App extends Application {
|
public class App extends Application {
|
||||||
Stage primaryStage;
|
Stage primaryStage;
|
||||||
@@ -22,6 +25,13 @@ public class App extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void start(Stage stage) throws Exception {
|
public void start(Stage stage) throws Exception {
|
||||||
|
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handle(WindowEvent event) {
|
||||||
|
Platform.exit();
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/scenes/main.fxml"));
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("/scenes/main.fxml"));
|
||||||
Parent root = loader.load();
|
Parent root = loader.load();
|
||||||
Scene scene = new Scene(root, 1200, 800);
|
Scene scene = new Scene(root, 1200, 800);
|
||||||
|
|||||||
Reference in New Issue
Block a user