Wednesday, May 16, 2012

JavaFX 2.0 Layouts: FlowPane

This is the fourth tutorial in JavaFX 2.0 Layout series. It's about FlowPane layout. FlowPane lays out its children in a flow that wraps at the flowpane's boundary. A horizontal flowpane (the default) will layout nodes in rows, wrapping at the flowpane's width. A vertical flowpane lays out nodes in columns, wrapping at the flowpane's height. If the flowpane has a border and/or padding set, the content will be flowed within those insets.
If you still have problems with creating Java project for JavaFX 2.0 in Eclipse IDE, check out Getting Started with JavaFX 2.0 in Eclipse IDE.

In this simple example I will demonstrate how FlowPane layout works.  Above you can see how the program will look in the end of this tutorial.  Below is the code of our example.

Check other tutorials from JavaFX Layout series by clicking on the image above.
javafx 2 layout


  1. ps: "import javafx.scene.layout.GridPane;" not needed can be removed

  2. Thanks for the feedback.

    Fixed. :)