Example usage for javafx.beans.binding Bindings min

List of usage examples for javafx.beans.binding Bindings min

Introduction

In this page you can find the example usage for javafx.beans.binding Bindings min.

Prototype

public static NumberBinding min(final int op1, final ObservableNumberValue op2) 

Source Link

Document

Creates a new javafx.beans.binding.NumberBinding that calculates the minimum of the value of a javafx.beans.value.ObservableNumberValue and a constant value.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Circle c = new Circle();
    Group root = new Group(c);
    Scene scene = new Scene(root, 100, 100);

    c.centerXProperty().bind(scene.widthProperty().divide(2));
    c.centerYProperty().bind(scene.heightProperty().divide(2));
    c.radiusProperty().bind(Bindings.min(scene.widthProperty(), scene.heightProperty()).divide(2));

    stage.setTitle("A Centered Circle");
    stage.setScene(scene);//from  ww  w .j  a  va  2  s.  c o  m
    stage.sizeToScene();
    stage.show();
}