Adds a point, specified by the integer arguments newx,newy
to the bounds of this Rectangle.
If this Rectangle has any dimension less than zero,
the rules for non-existant
rectangles apply.
In that case, the new bounds of this Rectangle will
have a location equal to the specified coordinates and
width and height equal to zero.
After adding a point, a call to contains with the
added point as an argument does not necessarily return
true. The contains method does not
return true for points on the right or bottom
edges of a Rectangle. Therefore, if the added point
falls on the right or bottom edge of the enlarged
Rectangle, contains returns
false for that point.
If the specified point must be contained within the new
Rectangle, a 1x1 rectangle should be added instead:
r.add(newx, newy, 1, 1);
newx | the X coordinate of the new point | |
newy | the Y coordinate of the new point |
Diagram: Rectangular Shapes