css - JavaFX - 用于定义 StageStyle 的 css 文件位于何处或如何更改它?

标签 css javafx window

问题:

I'm actually implementing some Frontend applications in JavaFX. There we're using several windows. In some cases the design of the windows have to be adapted like we want. That means it needs a specific icon, colour of the title and given images which replace the standard buttons for resizing, minimizing and closing the window. Consequently I have to adjust the whole title of the window.

我有什么:

It is no problem to set a new icon, but the rest of the adaptions lead to problems. During my researches I found, that it is possible to define the StageStyle within my programm with the help of:

primaryStage.initStyle(StageStyle.DECORATED);

可能的解决方案:

I know that a possible solution for my problem is, to set the StageStyle on Undecorated and to adding a node which contains the necessary icons, button etc (like it was done here: https://gist.github.com/JaDogg/4d9999ba233f4a43b7c5). This can be the root of my window.

我需要什么:

The problem with the possible solution is, that it is hard to define the border in the same way like it is done within StageStyle.DECORATED. But it is recommand that the border of the windows with our own icons, buttons etc have to be similiar to the borders of the standard windows. That's why I have the idea to adjust the element which was defined within the StageStyle. But the problem is, that I don't know the name of it. If I use .root within my css file just my root scene is taken. But I need the whole window.

Does anybody know how the element is defined? Or does anybody know the location of the css file where the StageStyles are defined?

If I got it, I also know the name of the element. In addition to this as soon as I have the css declaration it is obvious how to configure my own window to get the same border like in the standard window of StageStyle.DECORATED.

Or perhaps does anybody know how to define the border so that it looks like the one of StageStyle.DECORATED?

最佳答案

Stage 可以用一些 options 设置样式:装饰,未装饰,透明,...,而 Scene 可以使用 CSS 完全设置样式。但是没有用于舞台装饰的 CSS。

装饰未装饰舞台的好来源是这个 post .

如您所见,它的层模型允许您使用 CSS 装饰边框。但这将取决于您要模仿的操作系统。

对于 native 实现(主要是控件),请查看 these主题:适用于 Mac 的 AquaFX、适用于 Windows 7 的 AeroFX 或 this一个用于 Windows 8。

关于css - JavaFX - 用于定义 StageStyle 的 css 文件位于何处或如何更改它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27404375/

相关文章:

javascript - 关闭按钮在 div 内的 jQuery 中不起作用

HTML 和 CSS 没有链接/通信

css - 无法覆盖 CSS 中的 h2 属性

css - Jasny Bootstrap 在带有粘性页脚的移动屏幕上关闭 Canvas 导航

java - 使用 JavaFX 将图像拖到窗口外

jquery - 获取鼠标在 window.resize 上的位置

react-native - 寻找适用于 Windows 的免费 React Native IDE

javascript - setTimeout 是 javascript window 对象的一部分吗?

android - Gluon 移动 View 在 Android 上崩溃

java - 制作普通的泛型类