de.matthiasmann.twl
Class Rect

java.lang.Object
  extended by de.matthiasmann.twl.Rect
Direct Known Subclasses:
ClipStack.Entry, MouseSensitiveRectangle

public class Rect
extends java.lang.Object

An mutable rectangle class.


Constructor Summary
Rect()
           
Rect(int x, int y, int w, int h)
           
Rect(Rect src)
           
 
Method Summary
 int getBottom()
           
 int getCenterX()
           
 int getCenterY()
           
 int getHeight()
           
 int getRight()
           
 Dimension getSize()
           
 int getWidth()
           
 int getX()
           
 int getY()
           
 void intersect(Rect other)
          Computes the intersection of this rectangle with the other rectangle.
 boolean isEmpty()
           
 boolean isInside(int x, int y)
           
 void set(int x0, int y0, int x1, int y1)
           
 void set(Rect src)
           
 void setXYWH(int x, int y, int w, int h)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rect

public Rect()

Rect

public Rect(int x,
            int y,
            int w,
            int h)

Rect

public Rect(Rect src)
Method Detail

setXYWH

public void setXYWH(int x,
                    int y,
                    int w,
                    int h)

set

public void set(int x0,
                int y0,
                int x1,
                int y1)

set

public void set(Rect src)

intersect

public void intersect(Rect other)
Computes the intersection of this rectangle with the other rectangle. If they don't overlapp then this rect will be set to zero width and height.

Parameters:
other - The other rectangle to compute the intersection with

isInside

public boolean isInside(int x,
                        int y)

getX

public int getX()

getY

public int getY()

getRight

public int getRight()

getBottom

public int getBottom()

getWidth

public int getWidth()

getHeight

public int getHeight()

getCenterX

public int getCenterX()

getCenterY

public int getCenterY()

getSize

public Dimension getSize()

isEmpty

public boolean isEmpty()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object