Java examples for 2D Graphics:Rectangle
get Rectangle Center
//package com.java2s; import java.awt.Point; import java.awt.Rectangle; public class Main { public static Point getCenter(Rectangle rect) { return new Point(rect.x + rect.width / 2, rect.y + rect.height / 2); }// w w w . ja v a 2 s . com }