Java Rectangle subtractInsets(Rectangle base, Insets insets)

Here you can find the source of subtractInsets(Rectangle base, Insets insets)

Description

Returns the rectangle that results from removing the insets from a given rectangle.

License

LGPL

Parameter

Parameter Description
base input rectangle
insets amount that should be excluded from the edges of the base rectangle

Return

new, smaller rectangle

Declaration

public static Rectangle subtractInsets(Rectangle base, Insets insets) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.awt.Insets;

import java.awt.Rectangle;

public class Main {
    /**/*www .j a v a2  s. c o  m*/
     * Returns the rectangle that results from removing the insets from
     * a given rectangle.
     *
     * @param   base  input rectangle
     * @param   insets  amount that should be excluded from the edges of
     *                  the base rectangle
     * @return  new, smaller rectangle
     */
    public static Rectangle subtractInsets(Rectangle base, Insets insets) {
        return new Rectangle(base.x + insets.left, base.y + insets.top, base.width - insets.left - insets.right,
                base.height - insets.top - insets.bottom);
    }
}

Related

  1. resetPosition(Window window1, Window window2)
  2. right(Rectangle r)
  3. size(final Component component)
  4. subdivide(Dimension dimension, int threshold, int max)
  5. subdivideRectangle(int width, int height, int numTilesX, int numTilesY, int extraBorder)
  6. subtractInto(Insets i1, Rectangle r2)
  7. translate(RectangularShape r, double dx, double dy)