charva.awt
Class Rectangle

java.lang.Object
  extended bycharva.awt.Rectangle

public class Rectangle
extends java.lang.Object

The Rectangle class respresents a rectangular area of the screen; the boundaries are INCLUSIVE (i.e. the _right instance variable refers to the rightmost column that is included in the rectangular area, and the _bottom instance variable refers to the bottom row that is included in the rectangle. The width of the rectangle is given by (_right - _left +1). The height of the rectangle is given by (_bottom - _top + 1).


Constructor Summary
Rectangle(int top_, int left_, int bottom_, int right_)
          Construct a Rectangle with the specified boundaries.
Rectangle(Point topleft_, Dimension size_)
           
Rectangle(Point topleft_, Point bottomright_)
           
Rectangle(Rectangle rect_)
           
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this rectangle.
 boolean contains(int x, int y)
          Returns true if the specified point is inside this Rectangle.
 boolean contains(Point p)
          Returns true if the specified point is inside this Rectangle.
 boolean equals(Rectangle rect_)
          Returns true if this rectangle has the same bounds as the specified rectangle.
 int getBottom()
           
 int getLeft()
           
 int getRight()
           
 int getTop()
           
 Rectangle intersection(Rectangle rect_)
          Return the intersection between this Rectangle and the specified Rectangle, or null if the two rectangles don't intersect.
 boolean intersects(Rectangle rect_)
          Check if the specified rectangle intersects at all with this rectangle.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rectangle

public Rectangle(int top_,
                 int left_,
                 int bottom_,
                 int right_)
Construct a Rectangle with the specified boundaries.


Rectangle

public Rectangle(Point topleft_,
                 Point bottomright_)

Rectangle

public Rectangle(Point topleft_,
                 Dimension size_)

Rectangle

public Rectangle(Rectangle rect_)
Method Detail

contains

public boolean contains(Point p)
Returns true if the specified point is inside this Rectangle.


contains

public boolean contains(int x,
                        int y)
Returns true if the specified point is inside this Rectangle.


getLeft

public int getLeft()

getRight

public int getRight()

getTop

public int getTop()

getBottom

public int getBottom()

intersects

public boolean intersects(Rectangle rect_)
Check if the specified rectangle intersects at all with this rectangle.


intersection

public Rectangle intersection(Rectangle rect_)
Return the intersection between this Rectangle and the specified Rectangle, or null if the two rectangles don't intersect.


equals

public boolean equals(Rectangle rect_)
Returns true if this rectangle has the same bounds as the specified rectangle.


clone

public java.lang.Object clone()
Returns a clone of this rectangle.


toString

public java.lang.String toString()