我删除了主要阶段的默认边框:
I have removed the default borders around the primary stage:
stage.initStyle(StageStyle.UNDECORATED)这删除了我想要的窗口边框,但现在我想在窗口下面有一个阴影。
This removes the window borders which is what I want, but now I'd like to have a drop shadow under the window.
顶级 BorderPane 对象有一个 dropshadow 应用效果,但阴影被切断:
The top level BorderPane object has a dropshadow effect applied, but the shadow is cut off:
你可以在右下角看到阴影,但是一旦主应用区域结束,阴影就会被切断。
You can see the shadow slightly on the bottom right, but as soon as the main application area ends the shadow is cut off.
推荐答案我创建了一个前面的例子。使用在以后版本中链接的特定修订版本,我从对话框中删除了阴影效果。
I created an example for this earlier. Use the specific revision linked as in later revisions I dropped the shadow effect from the dialog.
示例将舞台内容放在包含两个窗格的StackPane中。阴影仅应用于背景窗格,对话框内容放置在顶部窗格中。顶部窗格的背景略微嵌入底部窗格,以便背景和阴影可以显示。
The sample places the stage content in a StackPane containing two panes. The shadow is only applied to the background Pane and the dialog content is placed in a top pane. The background of the top pane is slightly inset from the bottom pane so that the background and shadow can show through.
进一步的讨论是在显示未修饰/透明舞台周围的阴影。
Further discussion is in a thread on displaying a shadow around an undecorated/transparent stage.
更多推荐
如何在JavaFX中向窗口添加阴影?
发布评论