user1764823
user1764823

Reputation: 435

JavaFX CSS: add inner shadow to a pane itself

My CSS is:

.hollow {
    -fx-background-color: #dddddd;
    -fx-effect: innershadow( gaussian, rgba( 0, 0, 0, 0.5 ), 10, 0, 5, 5 );
}

I want to apply this effect to an HBox pane itself, giving it an appropriate CSS class, but instead of this the effect applies to its children (buttons, etc.).

How can I apply the effect only to the pane itself, living aside its children?

Edited:

Fixed a typo.

Upvotes: 2

Views: 6927

Answers (1)

CODEFTW
CODEFTW

Reputation: 23

It worked for me with code in the controller.

hBox.setEffect(new InnerShadow(BlurType.THREE_PASS_BOX, Color.GRAY,2,0,0,0));
hBox.setStyle("-fx-background-color: white");

I dont know why css doesnt work here.

Upvotes: 1

Related Questions