JavaFX CSS 属性和样式的最佳参考选择器
我正在尝试学习 JavaFX 2,但在尝试设计我的应用程序样式时遇到了很多困难。我发现此文档其中尝试记录控件和适用于它们的 CSS 属性。我无法判断它是否不完整,是否应该使用一些未知的选择器,或者 JavaFX 的 CSS 支持不够强大,无法满足我的需求。
以下是几个示例:
- 如何更改 TabPane 后面区域的背景颜色而不对其他所有子组件进行着色(是否有一个选择器,或者可能是一个属性?)
- 如何更改未选择的颜色选项卡?
I'm trying to learn JavaFX 2, but I've been stumbling a lot trying to style my application. I've found this document which tries to document controls and the css properties that apply to them. I can't tell if it's incomplete, if I should be using some unknown selectors or JavaFX's CSS support just isn't powerful enough for my needs.
Here are a couple of examples:
- How would I change the background color for the area behind a TabPane without coloring every other child component (is there a selector for that, or perhaps a property?)
- How would I change the color of non-selected tabs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你尝试过这样的事情吗?
这使用了 ID 选择器,如“使用 CSS 为 JavaFX 应用程序换肤”文档中所示。您还可以省略“#MyTabPane”选择器并将其应用于所有 TabPane。 (参考指南中似乎没有讨论 .tab 和 .tab-content-area 选择器。我转到 jfxrt.jar 文件中包含的“caspian.css”文件来查找它们。)
TabExample.css
TabPaneEx.java
Have you tried something like this?
This uses an ID selector as shown in the "Skinning JavaFX Applications with CSS" document. You could also leave off the "#MyTabPane" selector and have it apply to all TabPane's. (It looks like the .tab and .tab-content-area selectors are not discussed in the reference guide. I went to the "caspian.css" file contained in jfxrt.jar file to find them.)
TabExample.css
TabPaneEx.java
JavaFX CSS 参考指南
JavaFX 换肤使用 CSS 的应用程序
JavaFX CSS Reference Guide
Skinning JavaFX Applications with CSS