Drop and Inner shadow for button in javafx


Question

I have a button in javafx and its pseudoclass .button:pressed is supposed to have a drop and an inner shadow. What I'm trying is

.button:pressed {
    -fx-effect: dropshadow( gaussian , rgba(0,0,0,0.7) , 10,0,0,1 ); 
    -fx-effect: innershadow( gaussian , rgba(0,0,0,0.7) , 20,0,0,0 );
}

However, only the second effect seems to be applied to the button (actually, the effect whichever comes second will be applied). I've looked here: http://www.canoo.com/blog/2012/07/10/javafx-recipes-css-vs-code/?lang=de, but I don't see a difference to my approach. Is there a way to apply two shadows to one button?

Thank you.

1
2
10/9/2014 2:16:06 PM

Accepted Answer

It's currently not possible in Java 7 nor in Java 8 to chain effects or apply multiple effects via CSS. See the Oracle CSS Documentation.

The site you reference mentions it as well:

Well at the moment it is not possible to chain effects in CSS which means we only could apply one of the needed effects which would lead to the following result for the code aboveā€¦

3
12/5/2014 6:35:07 AM

Can't mix types (drop & inner), not even comma separated... I've tried, sorry.


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