JavaFX:样式未修饰的窗口,带有InnerShadow但没有顶部 [英] JavaFX: Style undecorated Window with InnerShadow but without top
问题描述
我创建了一个带有自己标题的未修饰窗口。对于这个我添加了一个样式:
I created an undecorated window with own title etc. For this one I added a style:
.pane-basicwindow{
-fx-border-color: gray;
-fx-border-style: solid;
-fx-border-width: 1;
-fx-effect: innershadow(three-pass-box, rgba(100, 100, 100, 1), 10, 0, 0, 0);}
借助于此,我创建了一个内部阴影。但我希望在左侧,右侧和底侧都有内置阴影。因此顶部应该没有阴影。我知道如果我更改了innershadow的最后一个值,我可以向上移动阴影的位置。例如像这样
With the help of this I created an innershadow. But I want to have the innershadow just on left, right and bottom side. Consequently the top side should be without shadow. I know that if I change the last value of the innershadow, I can move the position of the shadow upwards. For example like this
-fx-effect: innershadow(three-pass-box, rgba(100, 100, 100, 1), 10, 0, 0, -4);
但是在这种情况下,底部的阴影也会向上移动,因此这个阴影比一个更大一个右/左侧。
But in this case the shadow on bottom side also moves upwards so that this one is bigger than the one one right/left side.
所以我的问题是:必须做什么才能让左侧,右侧和底侧的阴影具有相同的尺寸顶部是看不见的?
我在这里检查了很多其他问题,但找不到我的案例的答案。我也玩了一点但是也找不到结果。有没有人有想法?
So my question is: What have to be done so that the shadows on left, right and bottom side have the same size while the innershadow on top is invisible? I checked a lot of other questions here but couldn't find an answer for my case. I also played a little bit with outsets but couldn't find a result, too. Does anybody has an idea?
推荐答案
您可以简单地重建阴影,只需将其添加到您喜欢的边框即可像这样:
You can "simply" rebuild the shadow and just add it to the borders you like, something like this:
.pane-basicwindow {
-fx-border-color:
linear-gradient(to right, rgba(0, 0, 0, 0.2), transparent),
linear-gradient(to top, rgba(0, 0, 0, 0.2), transparent),
linear-gradient(to left, rgba(0, 0, 0, 0.2), transparent);
-fx-border-style: solid;
-fx-border-width:
0 0 0 0.417em,
0 0 0.417em 0,
0 0.417em 0 0;
}
这篇关于JavaFX:样式未修饰的窗口,带有InnerShadow但没有顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!