Rectangle.inflate

Overview | Methods | Fields | ThisPackage | All Packages

Rectangle.inflate

Inflates this rectangle by the specified amount.

Syntax

public void inflate( int x, int y )

public void inflate( Point pt )

public static Rectangle inflate( Rectangle rect, int x, int y )

Parameters

x

The x value to use to formulate the rectangle's new x-coordinate and width. If this value is negative, the size of the rectangle is decreased.

y

The y value to use to formulate the rectangle's new y-coordinate and height. If this value is negative, the size of the rectangle is decreased.

pt

A Point object that specifies the x and y values by which to inflate the rectangle.

rect

A Rectangle object that specifies the rectangle to inflate.

Return Value

Returns a Rectangle object that describes the inflated rectangle.

Remarks

If you call the version of the inflateRect method that takes x, y, or pt parameters, the method formulates the new coordinates by subtracting the x and y coordinates from the current value of the rectangle's x and y coordinates. The new width of the rectangle is formulated by adding the product of x and 2 to the current width. The new height is formulated by adding the product of y and 2 to the current height.

The non-static versions of this method operate on this rectangle.  The static version of the member creates and returns a new Rectangle object that is an inflated version of this one.