forked from v98/ClassroomBookingsSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AlertBox.java
34 lines (25 loc) · 956 Bytes
/
AlertBox.java
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
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class AlertBox {
// We can use this one to display warnings like "loginID/password do not match etc"
public static void display(String title,String msg){
//title-->warning box ka title, msg-->warning jo display hogi
Stage window2=new Stage();
window2.initModality(Modality.APPLICATION_MODAL);
window2.setTitle(title);
window2.setMinWidth(300);
Label label=new Label(msg);
Button close=new Button("Ok");
close.setOnAction(e->window2.close());
VBox layout =new VBox(20);
layout.getChildren().addAll(label,close);
layout.setAlignment(Pos.CENTER);
window2.setScene(new Scene(layout));
window2.showAndWait();
}
}