Java examples for 2D Graphics:Rectangle
compact Rectangle2D
//package com.java2s; import java.awt.geom.Rectangle2D; public class Main { public static Rectangle2D compactRectangle2D(Rectangle2D r, double insetX, double insetY) { return new Rectangle2D.Double(r.getX() + insetX, r.getY() + insetY, r.getWidth() - insetX * 2, r.getHeight() - insetY * 2); }//from w ww .ja va 2 s . c om }