BorderPane is very well suited to develop more complex layouts. In general the
BorderPane provides five different regions: Top, Right, Bottom, Left and Center. You can set a
Node to each of these areas by calling the
setTop/setBottom/set… methods. This approach makes it very easy to develop “website-like” application windows where you have a menubar or toolbar at the top, a navigation on the left, some kind of footer at the bottom, your main content in the center area and possibly some additional information at the right.
It is important to know, that each of these areas resizes differently:
- The top and bottom areas will resize to their children preferred height and take all space available for their width.
- The left and right areas will resize to their children preferred width and take all space available for their height.
- The center area takes all space available for its height and its width.
Following graphic demonstrates the behavior of a
BorderPane when resizing your application window:
Take a look at this example: