How do I make a simple solid border around a FlowPane in javafx

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;
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)