Java examples for 2D Graphics:Rectangle
do Fit Rectangle2D
import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import org.apache.log4j.*; public class Main{ public static Rectangle2D doFit(Rectangle2D src, Rectangle2D target) { Rectangle2D out = new Rectangle2D.Double(); out.setFrameFromCenter(target.getCenterX(), target.getCenterY(), src.getWidth(), src.getHeight()); return out; }// w w w. j ava2s .c o m }