You can achieve this by wrapping your GridPane inside a ScrollPane.
Ideally you can edit it in the fxml file in scene builder and make the ScrollPane the parent, and the GridPane the child.
Or you can modify it in the code:
ScrollPane scrollPane = new ScrollPane(gridPane);
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);