JavaFX ScrollPane Scroll Style

I am trying to create a black and white ScrollPane in JavaFX. I have already created a CSS file that works very well. Except for this small square:

enter image description here

No matter what I try, I cannot turn it into 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 any way to change the color of this square? Thank you in advance!

+4
source share
2 answers

Just add the following selector using the desired color:

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

Use the corner class.

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

Source: https://habr.com/ru/post/1667538/


All Articles