Java java.awt Rectangle fields, constructors, methods, implement or subclass

Example usage for Java java.awt Rectangle fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.awt Rectangle.

The text is from its open source code.

Subclass

java.awt.Rectangle has subclasses.
Click this link to see all its subclasses.

Constructor

Rectangle(int x, int y, int width, int height)
Constructs a new Rectangle whose upper-left corner is specified as (x,y) and whose width and height are specified by the arguments of the same name.
Rectangle(int width, int height)
Constructs a new Rectangle whose upper-left corner is at (0, 0) in the coordinate space, and whose width and height are specified by the arguments of the same name.
Rectangle(Point p, Dimension d)
Constructs a new Rectangle whose upper-left corner is specified by the Point argument, and whose width and height are specified by the Dimension argument.
Rectangle()
Constructs a new Rectangle whose upper-left corner is at (0, 0) in the coordinate space, and whose width and height are both zero.
Rectangle(Rectangle r)
Constructs a new Rectangle , initialized to match the values of the specified Rectangle .
Rectangle(Point p)
Constructs a new Rectangle whose upper-left corner is the specified Point , and whose width and height are both zero.
Rectangle(Dimension d)
Constructs a new Rectangle whose top left corner is (0, 0) and whose width and height are specified by the Dimension argument.

Method

voidadd(int newx, int newy)
Adds a point, specified by the integer arguments newx,newy to the bounds of this Rectangle .
voidadd(Point pt)
Adds the specified Point to the bounds of this Rectangle .
voidadd(Rectangle r)
Adds a Rectangle to this Rectangle .
Objectclone()
Creates a new object of the same class and with the same contents as this object.
booleancontains(Point p)
Checks whether or not this Rectangle contains the specified Point .
booleancontains(Rectangle r)
Checks whether or not this Rectangle entirely contains the specified Rectangle .
booleancontains(int x, int y)
Checks whether or not this Rectangle contains the point at the specified location (x,y) .
booleancontains(int X, int Y, int W, int H)
Checks whether this Rectangle entirely contains the Rectangle at the specified location (X,Y) with the specified dimensions (W,H) .
Rectangle2DcreateIntersection(Rectangle2D r)
Rectangle2DcreateUnion(Rectangle2D r)
booleanequals(Object obj)
Checks whether two rectangles are equal.
RectanglegetBounds()
Gets the bounding Rectangle of this Rectangle .
Rectangle2DgetBounds2D()
doublegetCenterX()
Returns the X coordinate of the center of the framing rectangle of the Shape in double precision.
doublegetCenterY()
Returns the Y coordinate of the center of the framing rectangle of the Shape in double precision.
ClassgetClass()
Returns the runtime class of this Object .
doublegetHeight()
Returns the height of the bounding Rectangle in double precision.
PointgetLocation()
Returns the location of this Rectangle .
doublegetMaxX()
Returns the largest X coordinate of the framing rectangle of the Shape in double precision.
doublegetMaxY()
Returns the largest Y coordinate of the framing rectangle of the Shape in double precision.
doublegetMinX()
Returns the smallest X coordinate of the framing rectangle of the Shape in double precision.
doublegetMinY()
Returns the smallest Y coordinate of the framing rectangle of the Shape in double precision.
DimensiongetSize()
Gets the size of this Rectangle , represented by the returned Dimension .
doublegetWidth()
Returns the width of the bounding Rectangle in double precision.
doublegetX()
Returns the X coordinate of the bounding Rectangle in double precision.
doublegetY()
Returns the Y coordinate of the bounding Rectangle in double precision.
voidgrow(int h, int v)
Resizes the Rectangle both horizontally and vertically.
Rectangleintersection(Rectangle r)
Computes the intersection of this Rectangle with the specified Rectangle .
booleanintersects(Rectangle r)
Determines whether or not this Rectangle and the specified Rectangle intersect.
booleanintersects(double x, double y, double w, double h)
booleanisEmpty()
intoutcode(double x, double y)
voidsetBounds(int x, int y, int width, int height)
Sets the bounding Rectangle of this Rectangle to the specified x , y , width , and height .
voidsetBounds(Rectangle r)
Sets the bounding Rectangle of this Rectangle to match the specified Rectangle .
voidsetFrame(double x, double y, double w, double h)
Sets the location and size of the outer bounds of this Rectangle2D to the specified rectangular values.
voidsetLocation(int x, int y)
Moves this Rectangle to the specified location.
voidsetLocation(Point p)
Moves this Rectangle to the specified location.
voidsetRect(double x, double y, double width, double height)
Sets the bounds of this Rectangle to the integer bounds which encompass the specified x , y , width , and height .
voidsetRect(Rectangle2D r)
Sets this Rectangle2D to be the same as the specified Rectangle2D .
voidsetSize(Dimension d)
Sets the size of this Rectangle to match the specified Dimension .
voidsetSize(int width, int height)
Sets the size of this Rectangle to the specified width and height.
StringtoString()
Returns a String representing this Rectangle and its values.
voidtranslate(int dx, int dy)
Translates this Rectangle the indicated distance, to the right along the X coordinate axis, and downward along the Y coordinate axis.
Rectangleunion(Rectangle r)
Computes the union of this Rectangle with the specified Rectangle .
voidunion(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest)
Unions the pair of source Rectangle2D objects and puts the result into the specified destination Rectangle2D object.