更改JavaFX进度条样式

时间:2013-11-09 19:07:04

标签: javafx-2 javafx javafx-8

我想修改此代码并使进度条变为绿色:

.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%
        );
}

如何修改代码以更改可视布局?

1 个答案:

答案 0 :(得分:2)

只需覆盖颜色常量-fx-accent,渐变颜色源自:

.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%
        );
}
相关问题