JAVAFX 2.0 How can i change the slider icon in a slider to an image?

后端 未结 4 1776
刺人心
刺人心 2021-01-02 19:04

I want to change the icon to my image, I\'ve looked through the CSS reference guide but I can\'t seem to find anything relevant. Is it even possible? Doesn\'t matter if it i

4条回答
  •  萌比男神i
    2021-01-02 19:30

    If you want to remove the thumb background color and only have the image(semi-transparent ones like round button) then you should also -fx-background-color:transparent; unless you will have the background

    .slider .thumb {
        -fx-background-image :url("sider-round-thumb-image.png"); 
        -fx-padding: 16; /* My thumb image is 33x33 pixels,so padding is half */
        -fx-pref-height: 28;
        -fx-pref-width: 28;
    
        -fx-background-color:transparent;
    }
    

提交回复
热议问题