Java Rectangle subtractInto(Insets i1, Rectangle r2)

Here you can find the source of subtractInto(Insets i1, Rectangle r2)

Description

subtract Into

License

Open Source License

Declaration

public static void subtractInto(Insets i1, Rectangle r2) 

Method Source Code


//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;
    }
}

Related

  1. right(Rectangle r)
  2. size(final Component component)
  3. subdivide(Dimension dimension, int threshold, int max)
  4. subdivideRectangle(int width, int height, int numTilesX, int numTilesY, int extraBorder)
  5. subtractInsets(Rectangle base, Insets insets)
  6. translate(RectangularShape r, double dx, double dy)