I am unable to find a way to set the distance to the border in a GridPane. Now, the text starts immediately after the border stops, which is not very nice for the design. I could give all the children a padding, but I was thinking there must be a shorter way to do this (just some property of the GridPane).
Unfortunately, I was not able to find this anywhere online. I prefer a solution which uses FXML or CSS (preferably CSS), but if this must be done with some Java code, it is not a problem.
I have already tried:
- Setting the margin of the GridPane in the CSS:
#someGridPane { -fx-border-insets: 5; }
, but these insets are outside the border (and I want them inside). - Setting padding on all of the child elements, which is not as efficient as I had hoped).
So the question is: How to set the distance to the border in a GridPane?
Notes:
- I am using JavaFX8
- If the solution is somewhere online already, please let me know. (I searched for it for some time now)
Depending on what's in your grid pane you could cheat a bit.
Of course, add some style class names, but you get the idea.