Packages This Package Prev Next Index
public class java.awt.Rectangle extends java.lang.Object (I-§1.12) { // Fields public int height; §1.36.1 public int width; §1.36.2 public int x; §1.36.3 public int y; §1.36.4 // Constructors public Rectangle(); §1.36.5 public Rectangle(Dimension d); §1.36.6 public Rectangle(int width, int height); §1.36.7 public Rectangle(int x, int y, int width, int height); §1.36.8 public Rectangle(Point p); §1.36.9 public Rectangle(Point p, Dimension d); §1.36.10 // Methods public void add(int newx, int newy); §1.36.11 public void add(Point pt); §1.36.12 public void add(Rectangle r); §1.36.13 public boolean equals(Object obj); §1.36.14 public void grow(int h, int v); §1.36.15 public int hashCode(); §1.36.16 public boolean inside(int x, int y); §1.36.17 public Rectangle intersection(Rectangle r); §1.36.18 public boolean intersects(Rectangle r); §1.36.19 public boolean isEmpty(); §1.36.20 public void move(int x, int y); §1.36.21 public void reshape(int x, int y, int width, int height); §1.36.22 public void resize(int width, int height); §1.36.23 public String toString(); §1.36.24 public void translate(int dx, int dy); §1.36.25 public Rectangle union(Rectangle r); §1.36.26 }A rectangle specifies an area defined by its top-left coordinate, its width and its height.
public int height
public int width
public int x
public int y
public Rectangle()
public Rectangle(Dimension d)
d
-
the width and height
public Rectangle(int width, int height)
width
-
the width of the rectangle
height
-
the height of the rectangle
public Rectangle(int x, int y, int width, int height)
x
-
the x coordinate
y
-
the y coordinate
width
-
the width of the rectangle
height
-
the height of the rectangle
public Rectangle(Point p)
p
-
the top-left corner of the rectangle
public Rectangle(Point p, Dimension d)
p
-
the top left corner of the rectangle
d
-
the width and height
public void add(int newx, int newy)
newx
-
the x coordinate of the new point
newy
-
the y coordinate of the new point
public void add(Point pt)
pt
-
a point
public void add(Rectangle r)
r
-
a rectangle
public boolean equals(Object obj)
obj
-
the object to compare with
public void grow(int h, int v)
h
-
the horizontal expansion
v
-
the vertical expansion
public int hashCode()
public boolean inside(int x, int y)
x
-
the x coordinate
y
-
the y coordinate
public Rectangle intersection(Rectangle r)
r
-
a rectangle
public boolean intersects(Rectangle r)
r
-
a rectangle
public boolean isEmpty()
public void move(int x, int y)
x
-
the new x coordinate
y
-
the new y coordinate
public void reshape(int x, int y, int width, int height)
x
-
the new x coordinate
y
-
the new y coordinate
width
-
the new width
height
-
the new height
public void resize(int width, int height)
width
-
the new width
height
-
the new height
public String toString()
public void translate(int dx, int dy)
dx
-
the amount to move the rectangle to the right
dy
-
the amount to move the rectangle downward
public Rectangle union(Rectangle r)
r
-
a rectangle
Packages This Package Prev Next IndexJava API Document (HTML generated by dkramer on April 22, 1996)