use of com.jfoenix.controls.JFXAlert in project JFoenix by jfoenixadmin.
the class DialogController method init.
/**
* init fxml when loaded.
*/
@PostConstruct
public void init() {
root.getChildren().remove(dialog);
centerButton.setOnAction(action -> {
dialog.setTransitionType(DialogTransition.CENTER);
dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE));
});
topButton.setOnAction(action -> {
dialog.setTransitionType(DialogTransition.TOP);
dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE));
});
rightButton.setOnAction(action -> {
dialog.setTransitionType(DialogTransition.RIGHT);
dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE));
});
bottomButton.setOnAction(action -> {
dialog.setTransitionType(DialogTransition.BOTTOM);
dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE));
});
leftButton.setOnAction(action -> {
dialog.setTransitionType(DialogTransition.LEFT);
dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE));
});
acceptButton.setOnAction(action -> dialog.close());
alertButton.setOnAction(action -> {
JFXAlert alert = new JFXAlert((Stage) alertButton.getScene().getWindow());
alert.initModality(Modality.APPLICATION_MODAL);
alert.setOverlayClose(false);
JFXDialogLayout layout = new JFXDialogLayout();
layout.setHeading(new Label("Modal Dialog using JFXAlert"));
layout.setBody(new Label("Lorem ipsum dolor sit amet, consectetur adipiscing elit," + " sed do eiusmod tempor incididunt ut labore et dolore magna" + " aliqua. Utenim ad minim veniam, quis nostrud exercitation" + " ullamco laboris nisi ut aliquip ex ea commodo consequat."));
JFXButton closeButton = new JFXButton("ACCEPT");
closeButton.getStyleClass().add("dialog-accept");
closeButton.setOnAction(event -> alert.hideWithAnimation());
layout.setActions(closeButton);
alert.setContent(layout);
alert.show();
});
}
Aggregations