center JavaFX Bounds - Java JavaFX

Java examples for JavaFX:Rectangle

Description

center JavaFX Bounds

Demo Code


//package com.java2s;
import javafx.geometry.Bounds;
import javafx.geometry.Point2D;

public class Main {
    public static Point2D center(Bounds bounds) {
        return new Point2D(bounds.getMinX() + bounds.getWidth() / 2,
                bounds.getMinY() + bounds.getHeight() / 2);
    }/*from  w ww. j a v  a 2 s . c  om*/
}

Related Tutorials