Here you can find the source of subtractInto(Insets i1, Rectangle r2)
public static void subtractInto(Insets i1, Rectangle r2)
//package com.java2s; /*//from w ww . j a v a2 s.c om * @(#)InsetsUtil.java * * Copyright (c) 2004-2010 Werner Randelshofer * Hausmatt 10, Immensee, CH-6405, Switzerland. * All rights reserved. * * The copyright of this software is owned by Werner Randelshofer. * You may not use, copy or modify this software, except in * accordance with the license agreement you entered into with * Werner Randelshofer. For details see accompanying license terms. */ import java.awt.*; public class Main { public static void subtractInto(Insets i1, Rectangle r2) { r2.x += i1.left; r2.y += i1.top; r2.width -= i1.left + i1.right; r2.height -= i1.top + i1.bottom; } public static void subtractInto(int top, int left, int bottom, int right, Rectangle r2) { r2.x += left; r2.y += top; r2.width -= left + right; r2.height -= top + bottom; } }