I\'m having some problem regarding the default background and border of the ScrollPane. Using this style made the problem clearer to see.
setStyle(\"-fx-back
Honestly, your question was not clear enough, but I am only providing this answer to help others if I can.
What is causing this problem is you have the ScrollPane and inside it something called viewport that is bound to the ScrollPane. The properties that you apply for the ScrollPane object does not apply for the viewport. If you want to apply the properties for both ONLY, not the children too, you have to use the stylesheet property, not the style property itself, which uses in-line css code. For example, if you want to make the ScrollPane transparent, you have to apply the property for both, assuming the name of file is "scrollPane.css", like so:
#mainScrollPane > .viewport {
-fx-background-color: transparent;
}
#mainScrollPane {
-fx-background-color: transparent;
}
However, you need to apply a special Id property for the ScrollPane object, so it does not apply for the children:
ScrollPane scrollPane = new ScrollPane(root);
scrollPane.setId("mainScrollPane");
scrollPane.getStyleSheets().add("scrollPane.css");