Example usage for javafx.scene.layout HBox prefWidthProperty

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

Introduction

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

Prototype

public final DoubleProperty prefWidthProperty() 

Source Link

Usage

From source file:User.java

private HBox drawRow1() {
    Text userNameField = new Text();
    userNameField.setFont(Font.font("SanSerif", FontWeight.BOLD, 30));
    userNameField.setFill(foregroundColor);
    userNameField.setSmooth(true);//from w  w  w.ja v  a 2  s . co m

    // bind the field to the user.username
    userNameField.textProperty().bind(user.userNameProperty());

    HBox userNameCell = new HBox();
    userNameCell.prefWidthProperty().bind(primaryStage.widthProperty().subtract(45));
    userNameCell.getChildren().add(userNameField);

    HBox row1 = new HBox();
    row1.getChildren().addAll(userNameCell);

    return row1;
}