默认 JavaFX-CSS
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11922869/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Default JavaFX-CSS
提问by Gundon
Is there any way to see the applied CSS-Rules for JavaFX-Elements? Or there is a published reference with the default CSS-Rules available?
有什么方法可以查看 JavaFX-Elements 的应用 CSS 规则吗?或者有可用的默认 CSS 规则的已发布参考?
I would like, for example , to know the color of Toolbar's border.
例如,我想知道工具栏边框的颜色。
回答by sarcan
The CSS file is located in javafxrt.jar at jfxrt.jar!/com/sun/javafx/scene/control/skin/caspian/caspian.css .
CSS 文件位于 jfxrt.jar!/com/sun/javafx/scene/control/skin/caspian/caspian.css 的 javafxrt.jar 中。
Unfortunately, there is no API access to the CSS styles of an element as of now, though that is apparently being discussed for JavaFX 2.2.
不幸的是,目前还没有对元素 CSS 样式的 API 访问,尽管这显然是针对 JavaFX 2.2 进行讨论的。
回答by beardedlinuxgeek
Here is the extracted caspian.css on pastebin - http://pastebin.com/0PebD9nR
这是在 pastebin 上提取的 caspian.css - http://pastebin.com/0PebD9nR
回答by NDY
Modenatheme
摩德纳主题
With JavaFX 8 the default CSS is a new theme called Modena. See announcementwith screenshots.
在 JavaFX 8 中,默认 CSS 是一个名为Modena的新主题。请参阅带有屏幕截图的公告。
See the latest versions on the OpenJFX site at GitHub.
在 GitHub的OpenJFX 站点上查看最新版本。
The modena.css for the build version Java8_91 can be found here:
构建版本 Java8_91 的 modena.css 可以在这里找到:
https://gist.github.com/maxd/63691840fc372f22f470
https://gist.github.com/maxd/63691840fc372f22f470
If you search the css file in different JDK versions this is the way to go.
如果您在不同的 JDK 版本中搜索 css 文件,这是要走的路。
JDK below 10.0: $JAVA_HOME/jre/lib/ext/jfxrt.jar --> com/sun/javafx/scene/control/skin/modena.
JDK 10.0以下: $JAVA_HOME/jre/lib/ext/jfxrt.jar --> com/sun/javafx/scene/control/skin/modena.
JDK for 10.0 and higher: $JAVA_HOME/jmods/javafx.controls.jmod --> classes/com/sun/javafx/scene/control/skin/modena.
JDK 10.0 及更高版本: $JAVA_HOME/jmods/javafx.controls.jmod --> classes/com/sun/javafx/scene/control/skin/modena.
回答by mre
From Skinning JavaFX Applications with CSS: Default Style Sheet,
从Skinning JavaFX Applications with CSS: Default Style Sheet,
The default style sheet for JavaFX applications is caspian.css, which is found in the JavaFX runtime JAR file, jfxrt.jar
JavaFX 应用程序的默认样式表是 caspian.css,它可以在 JavaFX 运行时 JAR 文件 jfxrt.jar 中找到
and
和
Use the following command to extract the style sheet from the JAR file:
jar -xf jfxrt.jar com/sun/javafx/scene/control/skin/caspian/caspian.css
使用以下命令从 JAR 文件中提取样式表:
jar -xf jfxrt.jar com/sun/javafx/scene/control/skin/caspian/caspian.css
and then just use a css viewer.
然后只需使用 css 查看器。
回答by BeshEater
As for the end of 2019 the default modena.css
can be looked at official jfx github repo:
至于2019年底的默认modena.css
可以看jfx github官方repo:
Or you can look inside Maven javafx-controls. For example in javafx-controls-13-win.jar
go to /com/sun/javafx/scene/control/skin/modena/
或者您可以查看 Maven javafx-controls内部。例如在javafx-controls-13-win.jar
去/com/sun/javafx/scene/control/skin/modena/