get Rectangle2D Center 2D - Java 2D Graphics

Java examples for 2D Graphics:Rectangle

Description

get Rectangle2D Center 2D

Demo Code


//package com.java2s;

import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;

public class Main {
    public static Point2D.Double getCenter2D(Rectangle2D rect) {
        return new Point2D.Double(rect.getX() + rect.getWidth() / 2,
                rect.getY() + rect.getHeight() / 2);
    }/*from  ww w .  j  av a 2  s  .c  o  m*/
}

Related Tutorials