How to set padding between columns of a JavaFX GridPane?

Viewed 109551

I'm trying to show a 2-column grid in a javaFx program. This is how I'm setting up the grid:

    GridPane grid = new GridPane();

    ColumnConstraints column1 = new ColumnConstraints();
    column1.setPercentWidth(50);
    ColumnConstraints column2 = new ColumnConstraints();
    column2.setPercentWidth(50);
    grid.getColumnConstraints().addAll(column1, column2); 

Here's the problem. I want to show a small space between where one column ends, and the other starts. However, the columns are showing up as glued to one another.

Here's a screenshot:

screenshot

Here each column contains the 'item name' and 'process, edit, delete' buttons.

You can see how the columns are glued together. I want them to instead have some space between them.

How can I solve this?

The hierarchy of my overall UI is this:

Scene > ScrollPane > BorderPane > Vbox (Center) > GridPane

2 Answers
Related