Hello and welcome back to JavaFX 2 Layouts tutorial series. This is a tutorial about TilePane. The TilePane layout pane places all of the nodes in a grid in which each cell, or tile, is the same size. Nodes can be laid out horizontally (in rows) or vertically (in columns). Gap properties can be set to manage the spacing between the rows and columns. The padding property can be set to manage the distance between the nodes and the edges of the pane. Below you can take a look how our example will look in the end. |
Here is the code:
We could modify a little bit our example by using the
prefColumns
or prefRows
properties to establish the preferred size of the tile pane. Below you can take a look how our example will look after using prefColumns properties.
If you want, you can check other tutorials from JavaFX 2 Layouts series:
"tilePane.getChildren().add(btn);"
ReplyDeleteAin´t it better to collect them all into a List inside the loop and add them all to the Stage at once by using addAll?