Introduction
JavaFX is an open-source, next-generation client application platform for desktop, mobile, and embedded systems built on Java. It results from a collective effort between several individuals and businesses to create a cutting-edge, effective, and functionality toolkit for creating rich client applications.
This blog will discuss the BorderPane class present in the JavaFX framework. We will examine the different types of constructors and methods in this class. We will also discuss using different ways inside our code.
BorderPane
BorderPane organizes the nodes at the screen's left, right, center, top, and bottom. It is represented by javafx.scene.layout.BorderPane class. The setRight(), setLeft(), setCenter(), setBottom(), and setTop() methods of this class are used to set the position of the provided nodes. We require to instantiate BorderPane class to create the BorderPane layout.
The JavaFX BorderPane layout is notable because, unlike (most) others, it has pre-defined locations for where the components are to be set.
The syntax of JavaFX BorderPane is:
BorderPane bp = new BorderPane();
Constructors JavaFX BorderPane
The constructors of JavaFX BorderPane are as follow:
-
BorderPane(): It is used to create a BorderPane layout.
-
BorderPane(Node center): It is used to create a BorderPane layout with the specific node as the center of the pane.
- BorderPane(Node center, Node top, Node right, Node bottom, Node left): It is used to create a BorderPane layout with the given Nodes to use for each main layout area of the Border Pane.
Properties of JavaFX BorderPane
The five properties of JavaFX BorderPane and their Setter methods are discussed below. Note that all the below-mentioned properties belong to the Node type.

Methods of JavaFX BorderPane
-
clearConstraints(Nodechild): Removes all border pane constraints from the child node.
-
computeMinWidth(double height): It computes the minimum width of this region.
-
computeMinHeight(double width): It computes the minimum height of this region.
-
getAlignment(Node child): It returns the child's alignment constraint if set.
-
setAlignment(Node c, Pos value): Sets the alignment for the child when contained by a border pane.
-
getMargin(Node child): It returns the child's margin constraint if set.
-
setMargin(Nodec, Insert value): Sets the margin for the child when contained by a border pane.
-
computePrefWidth(double height): It computes the preferred width of this region for the given height.
-
computePrefHeight(double width): It determines this region's preferred height for the specified width; Region subclasses should override this method to provide a suitable value based on their content and layout approach.
-
getBottom(): Used to get the value of the property bottom.
-
getCenter(): Used to get the value of the property center.
-
getLeft(): Used to get the value of the property left.
-
getRight(): Used to get the value of the property right.
- getTop(): Used to get the value of the property top.





