sshahine / JFoenix

JavaFX Material Design Library
MIT License
6.27k stars 1.05k forks source link

JFXDialog Background Transparent #1177

Closed ElHurta closed 3 years ago

ElHurta commented 3 years ago

I'm creating a JFXDialog using a FXMLFile as Content for it, it's a StackPane that contains a ProgressIndicator, i'm trying to change the JFXDialog's background to Transparent, this is my CSS:

CS

And this is my Java Code:

`//Obtención del parent con la ruta del fxml a usar Parent parent = FXMLLoader.load(getClass().getResource("../Vista/Loading_Screen.fxml")); parent.setStyle("-fx-background-color: TRANSPARENT;");

    //Creación del Dialog usando el Parent como Region (cast) para poder personalizarlo:
    JFXDialog dialog = new JFXDialog();
    dialog.setContent((Region) parent);

    Background background = new Background(new BackgroundFill[]{new BackgroundFill(Color.TRANSPARENT, new CornerRadii(2.0D), (Insets)null)});
    dialog.setBackground(background);
    System.out.println(dialog.getBackground().getFills().get(0).getFill());

    //Se muestra el dialog:
    dialog.show(StackPane1);`