JavaFX Slider:跟踪长度?勾选标签颜色? [英] JavaFX Slider: Track length? Tick Label Color?

查看:236
本文介绍了JavaFX Slider:跟踪长度?勾选标签颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.slider .track {
    -fx-pref-width: 300px;
}

.slider .axis-tick-label {
    -fx-text-fill: white;
}

我为滑块编写CSS样式的微弱尝试都不起作用。我100%确定我的语法已关闭。有什么帮助?

My feeble attempts of writing CSS styles for the slider both don't work. I'm 100% sure my syntax is off. Any help?

推荐答案

你可以通过设置 -fx-pref-width 属性滑块并设置 -fx-tick-label-fill 属性c> .slider .axis

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; }





                     






注意:对于垂直滑块,要影响曲目的长度,你必须使用 -fx-pref-height 属性:


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 Slider:跟踪长度?勾选标签颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆