Java tutorial
//package com.java2s; //License from project: Apache License import java.awt.Insets; import java.awt.Rectangle; public class Main { static Rectangle applyInsets(final Rectangle bounds, final Insets insets) { final int x = bounds.x + insets.left; final int y = bounds.y + insets.top; final int width = bounds.width - insets.left - insets.right; final int height = bounds.height - insets.top - insets.bottom; return new Rectangle(x, y, width, height); } }