Using HBox and VBox in JavaFx

HBox:

HBox is a container in JavaFx  and it lays out its content nodes horizontally in a single row. Spacing between the content nodes can also be specified using spacing variable.

A simple example of HBox is:


var pageBox: HBox = HBox

{

   spacing:2;

   content:

   [

     for (pages in [0..noPages])

     {

        PageIndicator

        {

           pageNo: pages;

           changePageNo: changePageNumber;

        }
    }
  ]
}

Horizontal position of the row of nodes can also be specified by using the hPos variable  and similarly vPos variable can be used to specify the vertical positioning of the row of nodes. Vertical positioning of each nodes can be specified by using nodeVPos variable.

The output with total no of Pages 2 is:

More info:

http://download.oracle.com/docs/cd/E17802_01/javafx/javafx/1.2/docs/api/javafx.scene.layout/javafx.scene.layout.HBox.html

VBox:

VBox is a container in JavaFx  and it lays out its content nodes vertically in a single column. Similar to HBox, spacing between the content nodes can also be specified using spacing variable. The hPos and vPos variables can be used to specify the horizontal positioning of the column of nodes and the vertical positioning of the column of nodes respectively. Also as in HBox, nodeHPos variable in VBox can be used to  specify the horizontal position of each node within the layout space.

Advertisements