There’s a setBorder()
method, so you can add a border to your pane:
FlowPane pane = new FlowPane(10, 10);
pane.setBorder(new Border(new BorderStroke(Color.BLACK,
BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
Though this is really more simple with inline CSS:
pane.setStyle("-fx-border-color: black");
Or you could apply it with a CSS file:
FlowPane pane = new FlowPane(10, 10);
pane.getStyleClass().add("pane");
Scene scene = new Scene(pane, 300, 250);
scene.getStylesheets().add(getClass().getResource("root.css").toExternalForm());
where ‘root.css’ is in the same package and contains:
.pane {
-fx-border-color: black;
}