/* * 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 Controllers.Dialog; import Controllers.Traitement.MyWindow; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.scene.text.TextFlow; import javafx.stage.Stage; /** * * @author Maher Ben Tili */ public class Notification { public double Height = MyWindow.myStage.getHeight() ; public double Width = MyWindow.myStage.getWidth() ; public Button bouttonNo = new Button(); public Button bouttonOK = new Button(); public Text titre = new Text(); public TextFlow DetailMSG = new TextFlow(); public Text titreMSG = new Text(); public Text detail = new Text(); public StackPane stackpane = new StackPane(); public Node Setnotification(){ Group group = new Group(); AnchorPane Ap = new AnchorPane(); Ap.setStyle("-fx-background-color: rgba(0,0,0,0.6);"); Pane pa1 = new Pane(); pa1.setStyle("-fx-background-color:#ffffff; -fx-border-color: #212121; -fx-border-radius: 10 10 0 0; -fx-background-radius: 10 10 0 0;"); pa1.setPrefHeight(200); pa1.setPrefWidth(497); Pane pa2 = new Pane(); pa2.setStyle("-fx-background-color:linear-gradient(to bottom, #585858, #333333); -fx-background-radius: 10 10 0 0;"); pa2.setPrefHeight(30); pa2.setPrefWidth(497); titre.setText("Dialog de notification"); titre.setFont(Font.font("System", FontWeight.BOLD, 13)); titre.setFill(Color.web("#ffffff")); titre.setLayoutX(17); titre.setLayoutY(22); Image imgicon = new Image(getClass().getResourceAsStream("/Public/icon/dialoginform.png")); ImageView icon = new ImageView(imgicon); icon.setLayoutX(20); icon.setLayoutY(60); icon.setFitWidth(46); icon.setFitHeight(50); DetailMSG.setPrefHeight(120); DetailMSG.setPrefWidth(400); DetailMSG.setLayoutX(80); DetailMSG.setLayoutY(55); bouttonOK.setText("Valider"); bouttonOK.setFont(Font.font ("System", FontWeight.BOLD, 12)); bouttonOK.setStyle("{-fx-background-color:#EFEFEF; -fx-border-color: #959595; -fx-border-radius: 5 5 5 5;} hover:{-fx-background-color:#E6E6E6;}"); bouttonOK.setPrefWidth(73); bouttonOK.setPrefHeight(30); bouttonOK.setLayoutX(320); bouttonOK.setLayoutY(160); bouttonNo.setText("Annuler"); bouttonNo.setFont(Font.font ("System", FontWeight.BOLD, 12)); bouttonNo.setStyle("{-fx-background-color:#EFEFEF; -fx-border-color: #959595; -fx-border-radius: 5 5 5 5;} hover:{-fx-background-color:#E6E6E6;}"); bouttonNo.setPrefWidth(73); bouttonNo.setPrefHeight(30); bouttonNo.setLayoutX(410); bouttonNo.setLayoutY(160); bouttonNo.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { stackpane.setVisible(false); } }); group.getChildren().addAll(pa1, pa2, titre, icon, DetailMSG, bouttonOK, bouttonNo); stackpane.setVisible(true); stackpane.getChildren().add(Ap); stackpane.getChildren().add(group); return stackpane; } public void ShowNotification() { Node node = this.Setnotification(); StackPane Sp = new StackPane(); Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight); Sp.getChildren().add(MyWindow.myParent); Sp.getChildren().add(node); Scene scene = new Scene(Sp); Stage stage = MyWindow.myStage; stage.setScene(scene); stage.show(); } }