forked from jarolrod/java-solitaire
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlertWindow.java
More file actions
28 lines (23 loc) · 769 Bytes
/
AlertWindow.java
File metadata and controls
28 lines (23 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package GUI;
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.scene.control.*;
import javafx.geometry.*;
public class AlertWindow {
public static void display(String title, String message) {
Stage alertWindow = new Stage();
alertWindow.initModality(Modality.APPLICATION_MODAL);
alertWindow.setTitle(title);
alertWindow.setMinWidth(300);
Label messageLabel = new Label(message);
Button closeButton = new Button("Ok");
closeButton.setOnAction(e -> alertWindow.close());
VBox layout = new VBox(10);
layout.getChildren().addAll(messageLabel, closeButton);
layout.setAlignment(Pos.CENTER);
Scene alertScene = new Scene(layout);
alertWindow.setScene(alertScene);
alertWindow.showAndWait();
}
}