Example usage for javafx.scene.layout HBox getHgrow

List of usage examples for javafx.scene.layout HBox getHgrow

Introduction

In this page you can find the example usage for javafx.scene.layout HBox getHgrow.

Prototype

public static Priority getHgrow(Node child) 

Source Link

Document

Returns the child's hgrow constraint if set.

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    HBox hbox = new HBox();
    Button button1 = new Button("Add");
    Button button2 = new Button("Remove");
    HBox.setHgrow(button1, Priority.ALWAYS);
    HBox.setHgrow(button2, Priority.ALWAYS);
    button1.setMaxWidth(Double.MAX_VALUE);
    button2.setMaxWidth(Double.MAX_VALUE);
    hbox.getChildren().addAll(button1, button2);

    hbox.setPrefWidth(400);/*  w  w  w. j  a  va 2  s.co  m*/

    System.out.println(HBox.getHgrow(button1));

    root.getChildren().add(hbox);
    primaryStage.setScene(scene);
    primaryStage.show();
}