JavaFX ScrollPane样式 [英] JavaFX ScrollPane styling
本文介绍了JavaFX ScrollPane样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在JavaFX中创建黑白ScrollPane。我已经创建了一个CSS文件,可以正常工作。除了这个小方块:
I'm trying to create a black and white ScrollPane in JavaFX. I already created a CSS file, wich works pretty fine. Except for this little square:
无论我尝试什么,我无法将其变黑。
这是我的CSS文件:
Whatever I try, I'm not able to turn it black. Here is my CSS file:
.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;
}
有没有办法改变这个正方形的颜色?
Is there a way to change the colour of this square? Thank you in advance!
推荐答案
只需使用所需的颜色添加以下选择器:
Simply add the following selector using the needed color:
.scroll-pane > .corner {
-fx-background-color: black;
}
这篇关于JavaFX ScrollPane样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文