Example usage for javafx.scene.control Button getContentBias

List of usage examples for javafx.scene.control Button getContentBias

Introduction

In this page you can find the example usage for javafx.scene.control Button getContentBias.

Prototype

@Override
public Orientation getContentBias() 

Source Link

Document

If wrapText is true, then contentBias will be HORIZONTAL, otherwise it is null.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Button btn = new Button("Hello JavaFX!");

    HBox root = new HBox();
    root.getChildren().addAll(btn);// w w w.  j  av  a  2  s.c o  m

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Sizes of a Node");
    stage.show();

    btn.setWrapText(true);
    btn.setPrefWidth(80);
    stage.sizeToScene();

    System.out.println("btn.getContentBias() = " + btn.getContentBias());

    System.out.println(
            "btn.getPrefWidth() = " + btn.getPrefWidth() + ", btn.getPrefHeight() = " + btn.getPrefHeight());

    System.out.println(
            "btn.getMinWidth() = " + btn.getMinWidth() + ", btn.getMinHeight() = " + btn.getMinHeight());

    System.out.println(
            "btn.getMaxWidth() = " + btn.getMaxWidth() + ", btn.getMaxHeight() = " + btn.getMaxHeight());

    double prefWidth = btn.prefWidth(-1);
    System.out.println(
            "btn.prefWidth(-1) = " + prefWidth + ", btn.prefHeight(prefWidth) = " + btn.prefHeight(prefWidth));

    double minWidth = btn.minWidth(-1);
    System.out.println(
            "btn.minWidth(-1) = " + minWidth + ", btn.minHeight(minWidth) = " + btn.minHeight(minWidth));

    double maxWidth = btn.maxWidth(-1);
    System.out.println(
            "btn.maxWidth(-1) = " + maxWidth + ", btn.maxHeight(maxWidth) = " + btn.maxHeight(maxWidth));

    System.out.println("btn.getWidth() = " + btn.getWidth() + ", btn.getHeight() = " + btn.getHeight());
}