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