TilePane and FlowPane

TilePane places nodes in the grid of the same-sized tiles. You can set preferable column and row counts, but TilePane will rearrange them as space allows. 

In the following example, you can see different rectangles being located in the same-sized tiles:

Refer to the following code:

// chapter1/layoutmanagers/TilePaneDemo.javapublic class TilePaneDemo extends Application {        @Override    public void start(Stage primaryStage) {        TilePane root = new TilePane(5,5);        root.setPrefColumns(4);        root.setPrefRows(4);        // compare to        // FlowPane root = new FlowPane(5, 5);                for (int i = 0; i < 4; i++) {            for (int j = 0; j < 4; j++) { double ...

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.