Java examples for JavaFX:Rectangle
center JavaFX Rectangle2D
//package com.java2s; import static java.util.Objects.requireNonNull; import javafx.geometry.Point2D; import javafx.geometry.Rectangle2D; public class Main { public static Point2D center(Rectangle2D bounds) { requireNonNull(bounds, "bounds is null"); return new Point2D(bounds.getMinX() + bounds.getWidth() / 2d, bounds.getMinY() + bounds.getHeight() / 2d); }//ww w . j a v a 2 s .c o m }