here is my code:
def list = FXCollections.observableArrayList([])
GridView<Color> g = new GridView<>(list);
g.setCellFactory(new Callback<GridView<Color>, GridCell<Color>>() {
public GridCell<Color> call(GridView<Color> gridView) {
return new ColorGridCell();
}
});
Random r = new Random(System.currentTimeMillis());
for (int i = 0; i < 50; i++) {
list.add(new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), 1.0));
}
see my screenshot, the left padding and right padding is diff, how to align Gridview to center