-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlertBox.java
More file actions
49 lines (42 loc) · 1.4 KB
/
AlertBox.java
File metadata and controls
49 lines (42 loc) · 1.4 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package algortihmsfx;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
/**
*
* @author Ryan
*/
public class AlertBox {
TextField target = new TextField();
public void display(String title, String message) {
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle(title);
window.setMinWidth(250);
Label label = new Label();
label.setText(message);
Button submitButton = new Button("Submit");
submitButton.setOnAction(e -> window.close());
VBox layout = new VBox(10);
layout.setPadding(new Insets(10,10,10,10));
layout.getChildren().addAll(label, target, submitButton);
layout.setAlignment(Pos.CENTER);
Scene scene = new Scene(layout);
window.setScene(scene);
window.showAndWait();
}
public TextField getTarget() {
return target;
}
}