更改JavaFX进度条样式 [英] Change JavaFX progress bar style

查看:100
本文介绍了更改JavaFX进度条样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

推荐答案

只需覆盖颜色常量 -fx-accent 渐​​变颜色来自:

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

这篇关于更改JavaFX进度条样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆