So I have a border pane and I am trying to set its background color to black using CSS. When I directly set the style inline, like this:
borderPane.setStyle("-fx-background-color: black;");
it works perfectly fine. However, when I try to add a class selector and define the color within the selector, like this:
borderPane.getStyleClass().add("env-pane");
and use the following CSS:
.env-pane {
-fx-background-color: black;
}
No changes happen to the background color. I'm not sure if this issue is related to this. According to the JavaFX CSS reference, the Pane class does have the property -fx-background-color.
Just for context, other components on the scene are able to change based on the stylesheet without any issues.