Reputation: 99
I know that elements in Flow Pane layout in JavaFX are positioned next each other in one orientation. I want in the middle of this process to force JavaFX to put elements in a new line , to some extend like "\n" character in print method . How i can do this ?
Upvotes: 2
Views: 4388
Reputation: 884
A blank full width node behaves like "\n" in FlowPane
.
Region p = new Region();
p.setPrefSize(Double.MAX_VALUE, 0.0);
flowPane.getChildren().add(p);
I think this is effective in case you want to control line breaking as a node.
Upvotes: 2
Reputation: 2726
That isn't how FlowPane works. You may be better off using a GridPane so you can specify the number of rows/columns. Or you can use a composite layout and use a FlowPane for each row, then put all your FlowPanes in a VBox.
Upvotes: 1