|
|||||||||
| Home >> All >> jcurses >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
jcurses.util
Class Rectangle

java.lang.Objectjcurses.util.Rectangle
- public class Rectangle
- extends java.lang.Object
This is a class to represent an screen rectangle.
To implement this class was needed, because java.awt.rectangle
works with double's, this is by a text based terminal senseless.
| Field Summary | |
(package private) int |
_height
|
(package private) int |
_width
|
(package private) int |
_x
|
(package private) int |
_y
|
| Constructor Summary | |
Rectangle(int width,
int height)
The constructor, that defines only the size but no location |
|
Rectangle(int x,
int y,
int width,
int height)
The constructor |
|
| Method Summary | |
java.lang.Object |
clone()
This method may be called to create a new copy of the Object. |
boolean |
contains(int X,
int Y,
int W,
int H)
The method veriifies, whether a rectangle lies within this rectangle |
boolean |
contains(Rectangle rect)
The method veriifies, whether a rectangle lies within this rectangle |
int |
getHeight()
|
int |
getWidth()
|
int |
getX()
|
int |
getY()
|
boolean |
inside(int x,
int y)
The method veriifies, whether a point lies within this rectangle |
Rectangle |
intersection(Rectangle r)
The method returns an intersection of the rectangle with an other rectangle, that is, the greatest rectangle, that is contained in both. |
boolean |
isEmpty()
|
void |
resize(int width,
int height)
Changes the size of the rectangle |
void |
setHeight(int height)
Sets the height of the rectangle |
void |
setLocation(int x,
int y)
Sets the location of the rectangle |
void |
setWidth(int width)
Sets the width of the rectangle |
void |
setX(int x)
Sets the x coordinate of the top left corner |
void |
setY(int y)
Sets the y coordinate of the top left corner |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
Rectangle |
union(Rectangle r)
The method returns an union of the rectangle with an other rectangle, that is, the smallest rectangle, that contains both. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
_x
int _x
_y
int _y
_width
int _width
_height
int _height
| Constructor Detail |
Rectangle
public Rectangle(int x,
int y,
int width,
int height)
- The constructor
Rectangle
public Rectangle(int width,
int height)
- The constructor, that defines only the size but no location
| Method Detail |
getX
public int getX()
getY
public int getY()
getWidth
public int getWidth()
getHeight
public int getHeight()
setX
public void setX(int x)
- Sets the x coordinate of the top left corner
setY
public void setY(int y)
- Sets the y coordinate of the top left corner
setWidth
public void setWidth(int width)
- Sets the width of the rectangle
setHeight
public void setHeight(int height)
- Sets the height of the rectangle
isEmpty
public boolean isEmpty()
contains
public boolean contains(int X,
int Y,
int W,
int H)
- The method veriifies, whether a rectangle lies within this rectangle
contains
public boolean contains(Rectangle rect)
- The method veriifies, whether a rectangle lies within this rectangle
intersection
public Rectangle intersection(Rectangle r)
- The method returns an intersection of the rectangle with an other rectangle,
that is, the greatest rectangle, that is contained in both.
union
public Rectangle union(Rectangle r)
- The method returns an union of the rectangle with an other rectangle,
that is, the smallest rectangle, that contains both.
inside
public boolean inside(int x,
int y)
- The method veriifies, whether a point lies within this rectangle
setLocation
public void setLocation(int x,
int y)
- Sets the location of the rectangle
resize
public void resize(int width,
int height)
- Changes the size of the rectangle
clone
public java.lang.Object clone()
- Description copied from class:
java.lang.Object - This method may be called to create a new copy of the
Object. The typical behavior is as follows:
o == o.clone()is falseo.getClass() == o.clone().getClass()is trueo.equals(o)is true
However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>
Object.equals(Object)55 .If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.
Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.
All array types implement Cloneable, and override this method as follows (it should never fail):
public Object clone() { try { super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
|
|||||||||
| Home >> All >> jcurses >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
jcurses.util.Rectangle