2017-07-17 54 views
0

我想將一個陰影效果僅添加到節點的頂部。JavaFX隻影響一側

如果我使用:

-fx-effect: dropshadow(three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0.0 , 0); 

它添加陰影效果,所有邊框。

還有另一種方法來創建只有一個邊界的陰影效果?

回答

1

這是一種方法。選擇你想要的邊界:

node.setStyle("-fx-effect: dropshadow(three-pass-box, purple, 0.0, 25.0, 0.0, -5.0);"); //north 
node.setStyle("-fx-effect: dropshadow(three-pass-box, purple, 0.0, 25.0, 0.0, 5.0);"); //south 
node.setStyle("-fx-effect: dropshadow(three-pass-box, purple, 0.0, 25.0, 5.0, 0.0);"); //east 
node.setStyle("-fx-effect: dropshadow(three-pass-box, purple, 0.0, 25.0, -5.0, 0.0);"); //west