问题
.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