What i see:
What i want to see:
I tried to add shadow with css
but effect was visible only in SceneBuilder. Program window was shown without shadow.
.rootBorder {
-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.4), 10, 0.5, 0.0, 0.0);
}
How can i add some shadow to the stage? Thanks.
What's happening is that the shadow is being clipped off at the edge of the stage. If your root node is an instance of Region (which includes all the layouts) you can add padding.
region.setPadding(new Insets(20,20,20,20));
Then the drop shadow should appear. If the CSS doesn't work, you can also add the drop shadow in the code itself with:
stage.getScene().getRoot().setEffect(new DropShadow());
Edit: The scene will need to be transparent as well.
stage.getScene().setFill(Color.TRANSPARENT);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With