Default JavaFX-CSS

2019-04-04 16:35发布

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?

I would like, for example , to know the color of Toolbar's border.

4条回答
Emotional °昔
2楼-- · 2019-04-04 17:10

With JavaFX 8 the default CSS is a new theme called Modena.

The modena.css for the build version Java8_91 can be found here:

https://gist.github.com/maxd/63691840fc372f22f470

查看更多
淡お忘
3楼-- · 2019-04-04 17:18

The CSS file is located in javafxrt.jar at jfxrt.jar!/com/sun/javafx/scene/control/skin/caspian/caspian.css .

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.

查看更多
贼婆χ
4楼-- · 2019-04-04 17:27

From 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

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

and then just use a css viewer.

查看更多
乱世女痞
5楼-- · 2019-04-04 17:31

Here is the extracted caspian.css on pastebin - http://pastebin.com/0PebD9nR

查看更多
登录 后发表回答