Is there any way to make the Divider in a split pane transparent?
I have tried the following approach
.split-pane *.split-pane-divider {
-fx-padding: 0 1 0 1;
}
But it doesn't work.
Also, I would rather do it from the java code, if it's possible.
splitPane.setStyle("");
With CSS:
.split-pane:horizontal > .split-pane-divider {
-fx-background-color: transparent;
}
.split-pane:vertical > .split-pane-divider {
-fx-background-color: transparent;
}
By code, you need to find the divider and apply the style to it. Since there's no API for that, one easy way is with a lookup, after the stage is shown:
@Override
public void start(Stage primaryStage) {
SplitPane split = new SplitPane();
...
Scene scene = new Scene(split);
primaryStage.setScene(scene);
primaryStage.show();
Node divider = split.lookup(".split-pane-divider");
if(divider!=null){
divider.setStyle("-fx-background-color: transparent;");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With