-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPopUpWindow.java
More file actions
37 lines (28 loc) · 1013 Bytes
/
PopUpWindow.java
File metadata and controls
37 lines (28 loc) · 1013 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
29
30
31
32
33
34
35
36
37
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.scene.control.*;
import javafx.geometry.*;
public class PopUpWindow {
public static void display(String title, String message) {
Stage popWin = new Stage();
popWin.initModality(Modality.APPLICATION_MODAL);
popWin.setTitle(title);
popWin.setMinWidth(250);
Label label = new Label();
label.setText(message);
// This button will close the popup window. Refer to HammersWindow for
// confirmations.
Button weaponButton = new Button("Choose Mole Whacker");
weaponButton.setOnAction(e -> HammersWindow.display("Weapon Selection", "Choose wisely"));
// weaponButton.setOnAction(e -> window.WAM(begin));
// Add functionality to go back to the WAM window.
VBox layout = new VBox(25);
layout.getChildren().addAll(label, weaponButton);
layout.setAlignment(Pos.CENTER);
Scene scene = new Scene(layout);
popWin.setScene(scene);
// This method has to be closed.
popWin.showAndWait();
}
}