jcurzez
Class Rectangle

java.lang.Object
  |
  +--jcurzez.Rectangle

public class Rectangle
extends java.lang.Object

A rectangle is defined by its bounds (top, left, right, bottom) a background pen, and a drawing pen. The first pen will be used to fill in the rectangle when new room is created. This is a kind of background pen. The second one is the one you should change when you want to write a new thing on the window, using different colors and/or attributes.

This class doesn't provide drawing primitives, since drawing is delegated to AbstractWindow.

Version:
0.0.3
Author:
Thomas Girard
See Also:
BackgroundColor

Field Summary
protected  int bottom
          bottom coordinate of this rectangle.
protected  Pen drawingPen
          pen used to draw new cells in this rectangle.
protected  FillingPen fillingPen
          pen used to fill in this rectangle.
protected  int left
          left coordinate of this rectangle.
protected  int right
          right coordinate of this rectangle.
protected  int top
          top coordinate of this rectangle.
 
Constructor Summary
  Rectangle(int left, int top, int right, int bottom)
          Creates a new Rectangle with the specified bounds, and a default pen for drawing and filling.
  Rectangle(int left, int top, int right, int bottom, Pen fillingPen)
          Creates a new Rectangle with the specified bounds, specified pen fo filling, and a default pen for drawing.
protected Rectangle(int left, int top, int right, int bottom, Pen fillingPen, Pen drawingPen)
          Creates a new Rectangle with the specified bounds, and specified background color.
 
Method Summary
 int getBottom()
          Returns the bottom coordinate.
 Pen getDrawingPen()
          Returns the drawing pen of this rectangle.
 Pen getFillingPen()
          Returns the filling pen.
 int getHeight()
          Returns the height of the rectangle.
 int getLeft()
          Returns the left coordinate.
 int getRight()
          Returns the right coordinate.
 int getTop()
          Returns the top coordinate.
 int getWidth()
          Returns the width of the rectangle.
 java.lang.String toString()
          Returns a representation of this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

top

protected int top
top coordinate of this rectangle.


left

protected int left
left coordinate of this rectangle.


right

protected int right
right coordinate of this rectangle.


bottom

protected int bottom
bottom coordinate of this rectangle.


fillingPen

protected final FillingPen fillingPen
pen used to fill in this rectangle.


drawingPen

protected final Pen drawingPen
pen used to draw new cells in this rectangle.

Constructor Detail

Rectangle

public Rectangle(int left,
                 int top,
                 int right,
                 int bottom)
Creates a new Rectangle with the specified bounds, and a default pen for drawing and filling.

Parameters:
left - left coordinate.
top - top coordinate.
right - right coordinate.
bottom - bottom coordinate.

Rectangle

public Rectangle(int left,
                 int top,
                 int right,
                 int bottom,
                 Pen fillingPen)
Creates a new Rectangle with the specified bounds, specified pen fo filling, and a default pen for drawing.

Parameters:
left - left coordinate.
top - top coordinate.
right - right coordinate.
bottom - bottom coordinate.
fillingPen - the pen used to fill cells.

Rectangle

protected Rectangle(int left,
                    int top,
                    int right,
                    int bottom,
                    Pen fillingPen,
                    Pen drawingPen)
Creates a new Rectangle with the specified bounds, and specified background color.

Parameters:
left - left coordinate.
top - top coordinate.
right - right coordinate.
bottom - bottom coordinate.
fillingPen - the pen to fill the rectangle.
drawingPen - the pen to draw new cells.
Method Detail

getLeft

public int getLeft()
Returns the left coordinate.

Returns:
the left coordinate.

getTop

public int getTop()
Returns the top coordinate.

Returns:
the top coordinate.

getRight

public int getRight()
Returns the right coordinate.

Returns:
the right coordinate.

getBottom

public int getBottom()
Returns the bottom coordinate.

Returns:
the bottom coordinate.

getHeight

public int getHeight()
Returns the height of the rectangle.

Returns:
the height of the rectangle.

getWidth

public int getWidth()
Returns the width of the rectangle.

Returns:
the width of the rectangle.

getDrawingPen

public Pen getDrawingPen()
Returns the drawing pen of this rectangle.

Returns:
drawingPen.

getFillingPen

public Pen getFillingPen()
Returns the filling pen.

Returns:
fillingPen.

toString

public java.lang.String toString()
Returns a representation of this.

Overrides:
toString in class java.lang.Object
Returns:
a representation of this.


Send me an email