简体   繁体   中英

JavaFX ScrollPane styling

I'm trying to create a black and white ScrollPane in JavaFX. I already created a CSS file, which works pretty fine. Except for this little square:

在此处输入图片说明

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 color of this square?

Simply add the following selector using the needed color:

.scroll-pane > .corner {
    -fx-background-color: black;
}

Use "corner" class.

.scroll-pane > .corner {
      -fx-background-color: black;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM