Skip to content

Commit 739ea66

Browse files
committed
Changed exit alert button style.
1 parent 5167862 commit 739ea66

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/main/java/ee/ut/similaritydetector/ui/SimilarityDetectorLauncher.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,10 @@ private void showExitConfirmationAlert(WindowEvent windowEvent) {
6363
alert.setTitle("");
6464
alert.setHeaderText("Are you sure you want to exit?");
6565
//alert.setContentText("Results might not have been saved.");
66-
ButtonType exitButton = new ButtonType("Exit");
67-
ButtonType cancelButton = ButtonType.CANCEL;
68-
alert.getButtonTypes().setAll(cancelButton, exitButton);
69-
// TODO: default button
70-
//Deactivate Defaultbehavior for yes-Button:
71-
Button yesButton = (Button) alert.getDialogPane().lookupButton(exitButton);
72-
yesButton.setDefaultButton(false);
73-
//Activate Defaultbehavior for no-Button:
74-
Button noButton = (Button) alert.getDialogPane().lookupButton(cancelButton);
75-
noButton.setDefaultButton(true);
66+
ButtonType exitButtonType = ButtonType.OK;
67+
Button exitButton = (Button) alert.getDialogPane().lookupButton(ButtonType.OK);
68+
exitButton.setText("Exit");
69+
7670
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
7771
stage.getIcons().add(new Image(getClass().getResourceAsStream("/ee/ut/similaritydetector/img/app_icon.png")));
7872
// Dark mode
@@ -81,7 +75,7 @@ private void showExitConfirmationAlert(WindowEvent windowEvent) {
8175
"/ee/ut/similaritydetector/style/dark_mode.scss")));
8276
}
8377
Optional<ButtonType> buttonType = alert.showAndWait();
84-
if (buttonType.isPresent() && buttonType.get() == exitButton) {
78+
if (buttonType.isPresent() && buttonType.get() == exitButtonType) {
8579
Platform.exit();
8680
} else {
8781
windowEvent.consume();

0 commit comments

Comments
 (0)