From 5a713414a3167bd91bd4d865c286daf87ba1796b Mon Sep 17 00:00:00 2001 From: WiredSpast Date: Sat, 21 May 2022 13:51:50 +0200 Subject: [PATCH] Set G-Earth as owner of all alerts --- G-Earth/src/main/java/gearth/GEarth.java | 5 +++++ .../src/main/java/gearth/ui/titlebar/TitleBarController.java | 1 + 2 files changed, 6 insertions(+) diff --git a/G-Earth/src/main/java/gearth/GEarth.java b/G-Earth/src/main/java/gearth/GEarth.java index c6f7269..7982f9a 100644 --- a/G-Earth/src/main/java/gearth/GEarth.java +++ b/G-Earth/src/main/java/gearth/GEarth.java @@ -16,6 +16,7 @@ import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; +import javafx.scene.control.Alert; import javafx.scene.image.Image; import javafx.stage.Stage; import javafx.stage.StageStyle; @@ -166,4 +167,8 @@ public class GEarth extends Application { public static Theme getTheme() { return observableTheme.getObject(); } + + public static void setAlertOwner(Alert alert) { + alert.initOwner(main.stage); + } } diff --git a/G-Earth/src/main/java/gearth/ui/titlebar/TitleBarController.java b/G-Earth/src/main/java/gearth/ui/titlebar/TitleBarController.java index ed9c87f..b2a7c16 100644 --- a/G-Earth/src/main/java/gearth/ui/titlebar/TitleBarController.java +++ b/G-Earth/src/main/java/gearth/ui/titlebar/TitleBarController.java @@ -49,6 +49,7 @@ public class TitleBarController { } public static TitleBarController create(Alert alert) throws IOException { + GEarth.setAlertOwner(alert); FXMLLoader loader = new FXMLLoader(TitleBarController.class.getResource("Titlebar.fxml")); Parent titleBar = loader.load();