mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 17:07:55 -04:00
launcher: make modals closeable with esc key
This commit is contained in:
parent
f9c791cf39
commit
95da6eb9e2
@ -29,6 +29,8 @@ import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.stage.Modality;
|
||||
@ -79,6 +81,11 @@ public class MainWindow implements Initializable {
|
||||
stage.close();
|
||||
}
|
||||
});
|
||||
stage.addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent event) -> {
|
||||
if (event.getCode() == KeyCode.ESCAPE) {
|
||||
stage.close();
|
||||
}
|
||||
});
|
||||
stage.show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -195,6 +202,12 @@ public class MainWindow implements Initializable {
|
||||
stage.setTitle(LocaleManager.translate(Strings.SETTINGS_TITLE));
|
||||
stage.getIcons().add(GUITools.logo);
|
||||
stage.setScene(new Scene(parent));
|
||||
stage.addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent event) -> {
|
||||
if (event.getCode() == KeyCode.ESCAPE) {
|
||||
stage.close();
|
||||
}
|
||||
});
|
||||
|
||||
stage.show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
Loading…
x
Reference in New Issue
Block a user