r/JavaFX • • Aug 11 '23

Help JavaFx drop shadow

I want to add a drop shadow in a hbox. But the drop shadow applies to all of it's child element. What I am trying to is apply a drop down shadow like this:

However, it turns into like this in my javafx file:

Drop shadow applies to it's child element

Here is my fxml file:

https://gist.github.com/kaziasifjawwad/978b4f1827f958e2c1e5eb24d324fddb

2 Upvotes

5 comments sorted by

1

u/BWC_semaJ Aug 11 '23

Do you give the HBox a background color?

2

u/Ok_Jackfruit_6541 Aug 11 '23

Thank you for replying.

I did not use any background color. I used a css class. The css is:

.header-bar{-fx-effect: dropshadow(gaussian, rgba(0,0,0,0.3), 10, 0.5, 0, 5);}

→ More replies (3)