Rectangle.Rectangle

Rectangle.Rectangle

Class Overview | Class Members | This Package | All Packages

Syntax 1
public Rectangle()
Description
Constructs a new rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are zero.



Syntax 2
public Rectangle( Rectangle r )
Parameters
r
a rectangle from which to copy initial values.
Description
Constructs a new rectangle, initialized to match the values of the specificed rectangle.



Syntax 3
public Rectangle( int x, int y, int width, int height )
Parameters
x
the x coordinate.
y
the y coordinate.
width
the width of the rectangle.
height
the height of the rectangle.
Description
Constructs a new rectangle whose top-left corner is specified as (xy) and whose width and height are specified by the arguments of the same name.



Syntax 4
public Rectangle( int width, int height )
Parameters
width
the width of the rectangle.
height
the height of the rectangle.
Description
Constructs a new rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are specified by the arguments of the same name.



Syntax 5
public Rectangle( Point p, Dimension d )
Parameters
p
a point, the top-left corner of the rectangle.
d
a dimension, representing the width and height.
Description
Constructs a new rectangle whose top-left corner is specified by the point argument, and whose width and height are specified by the dimension argument.



Syntax 6
public Rectangle( Point p )
Parameters
p
the top left corner of the rectangle.
Description
Constructs a new rectangle whose top-left corner is the specified point, and whose width and height are zero.



Syntax 7
public Rectangle( Dimension d )
Parameters
d
a dimension, specifying width and height.
Description
Constructs a new rectangle whose top left corner is (0, 0) and whose width and height are specified by the dimension argument.