Thursday, May 24, 2012

Create StackPane using FXML

javafx.scene.layout.StackPane lays out its children in a back-to-front stack.

The z-order of the children is defined by the order of the children list with the 0th child being the bottom and last child on top. If a border and/or padding have been set, the children will be layed out within those insets.

The stackpane will attempt to resize each child to fill its content area. If the child could not be sized to fill the stackpane (either because it was not resizable or its max size prevented it) then it will be aligned within the area using the alignment property, which defaults to Pos.CENTER.

StackPane


<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.textfield.*?>

<StackPane fx:controller="javafxml.Sample" xmlns:fx="http://javafx.com/fxml"
    prefHeight="200" prefWidth="400" >
        
        <Button text="Bottom Button" />
        <Button text="Button" />
        <Text text="Text"/>
        
</StackPane>


Compare to create StackPane using Java code.


No comments:

Post a Comment