JavaFX Slider: Track length? Tick Label Color?

若如初见. 提交于 2020-01-05 07:03:54

问题


.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?


回答1:


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


来源:https://stackoverflow.com/questions/44061828/javafx-slider-track-length-tick-label-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!