JavaFX BorderPane

BorderPane arranges the nodes at the left, right, centre, top and bottom of the screen. It is represented by javafx.scene.layout.BorderPane class. This class provides various methods like setRight(), setLeft(), setCenter(), setBottom() and setTop() which are used to set the position for the specified nodes. We need to instantiate BorderPane class to create the BorderPane layout.

Properties

The properties of BorderPane class along with their setter methods are given in the table below.

TypePropertySetter MethodsDescription
NodeBottomsetBottom()Add the node to the bottom of the screen
NodeCentresetCentre()Add the node to the centre of the screen
NodeLeftsetLeft()Add the node to the left of the screen
NodeRightsetRight()Add the node to the right of the screen
NodeTopsetTop()Add the node to the top of the screen

Constructors

There are the following constructors in the class.

  1. BorderPane() : create the empty layout
  2. BorderPane(Node Center) : create the layout with the center node
  3. BorderPane(Node Center, Node top, Node right, Node bottom, Node left) : create the layout with all the nodes

Example


JavaFX BorderPane Output
Next TopicJavaFX HBox




Latest Courses