Change JavaFX progress bar style

隐身守侯 提交于 2019-12-13 21:00:58

问题


I want to modify this code and make the progress bar green:

.progress-bar > .bar {
    -fx-background-color: linear-gradient(
        from 0px .75em to .75em 0px,
        repeat,
        -fx-accent 0%,
        -fx-accent 49%,
        derive(-fx-accent, 30%) 50%,
        derive(-fx-accent, 30%) 99%
        );
}

How I can modify the code to change the visual layout?


回答1:


Simply overwrite the color constant -fx-accent the gradient colors are derived from:

.progress-bar > .bar {
    -fx-accent: green;
    -fx-background-color: linear-gradient(
        from 0px .75em to .75em 0px,
        repeat,
        -fx-accent 0%,
        -fx-accent 49%,
        derive(-fx-accent, 30%) 50%,
        derive(-fx-accent, 30%) 99%
        );
}


来源:https://stackoverflow.com/questions/19881884/change-javafx-progress-bar-style

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