JavaFX CSS: add inner shadow to a pane itself


Question

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.

1
0
5/29/2014 6:34:00 AM

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.

0
5/13/2016 6:31:36 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon