Drop-shadow in an undecorated Pane

前端 未结 4 1993
时光说笑
时光说笑 2020-12-06 07:15

I\'m trying to make my Pane a little bit better, visually, so, what I\'m doing is: set my stage UNDECORATED (OK) and (TRYING) to add a drop-shadow effect (NOT OK).

I\

4条回答
  •  时光说笑
    2020-12-06 08:03

    Stage dropshadow without FXML:

    public void start(Stage stage){
        final double RADIUS = 5;
        VBox rootNode = new VBox();
        Insets bgInsets = new Insets(RADIUS);
        BackgroundFill bgFill = new BackgroundFill(Color.PINK, null, bgInsets);
        rootNode.setBackground(new Background(bgFill));
        DropShadow dropShadow = new DropShadow(RADIUS, Color.GRAY);
        rootNode.setEffect(dropShadow);
    
        Scene scene = new Scene(rootNode);
        scene.setFill(Color.TRANSPARENT);
        stage.setScene(scene);
        stage.initStyle(StageStyle.TRANSPARENT);
        stage.show();
    }
    

提交回复
热议问题