我正在尝试在JavaFX中创建黑白ScrollPane。我已经创建了一个CSS文件,非常好用。除了这个小广场:
无论我尝试什么,我都无法将其变黑。 这是我的CSS文件:
.scroll-pane {
-fx-background-color: black;
}
.scroll-bar:horizontal, .scroll-bar:vertical{
-fx-background-color:transparent;
}
.increment-button, .decrement-button {
-fx-background-color: transparent;
-fx-border-color: transparent;
}
.scroll-bar:horizontal .track,
.scroll-bar:vertical .track{
-fx-background-color: transparent;
-fx-border-color: transparent;
-fx-background-radius: 0em;
}
.scroll-bar:horizontal .thumb,
.scroll-bar:vertical .thumb {
-fx-background-color: white;
-fx-background-radius: 5em;
}
有没有办法改变这个方块的颜色?提前谢谢!
答案 0 :(得分:13)
只需使用所需颜色添加以下选择器:
.scroll-pane > .corner {
-fx-background-color: black;
}
答案 1 :(得分:3)
使用"角落"类。
.scroll-pane > .corner {
-fx-background-color: black;
}