JavaFX Slider: Track length? Tick Label Color?(JavaFX 滑块:轨道长度?勾选标签颜色?)
问题描述
.slider .track {-fx-pref-宽度:300px;}.slider .axis-tick-label {-fx-文本填充:白色;}
我为滑块编写 CSS 样式的微弱尝试都不起作用.我 100% 确定我的语法是关闭的.有什么帮助吗?
解决方案可以通过设置
slider
的-fx-pref-width
属性并设置.slider .axis
的-fx-tick-label-fill
属性:.slider { -fx-pref-width: 300px;}.slider .axis { -fx-tick-label-fill:白色;}
<上一页>
<小时>
注意:对于垂直的Slider
,要影响轨道的长度,必须使用-fx-pref-height
属性:
.slider:vertical { -fx-pref-height:300px;}
.slider .track {
-fx-pref-width: 300px;
}
.slider .axis-tick-label {
-fx-text-fill: white;
}
My feeble attempts of writing CSS styles for the slider both don't work. I'm 100% sure my syntax is off. Any help?
You can do it by setting the -fx-pref-width
attribute of slider
and setting the -fx-tick-label-fill
attribute of .slider .axis
:
.slider { -fx-pref-width: 300px; }
.slider .axis { -fx-tick-label-fill: white; }
Note: For vertical Slider
, to affect the length of the track, you have to use the -fx-pref-height
attribute:
.slider:vertical { -fx-pref-height:300px; }
这篇关于JavaFX 滑块:轨道长度?勾选标签颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:JavaFX 滑块:轨道长度?勾选标签颜色?


- 如何指定 CORS 的响应标头? 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- 获取数字的最后一位 2022-01-01
- 转换 ldap 日期 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01