org.jdrawing.graphics
Class RectangleOperation

java.lang.Object
  extended byorg.jdrawing.graphics.GraphicsOperation
      extended byorg.jdrawing.graphics.RectangleOperation
All Implemented Interfaces:
DrawingElement
Direct Known Subclasses:
AbstractDrawRect, AbstractFillRect, DrawOval, FillOval

public abstract class RectangleOperation
extends GraphicsOperation

Base class for operations, which get Rectangle as argument.


Constructor Summary
RectangleOperation(int x, int y, int width, int height)
          Returns RectangleOperation with given rectangle.
RectangleOperation(int x, int y, int width, int height, Style style)
          Returns RectangleOperation with given rectangle and style.
 
Method Summary
 boolean equals(java.lang.Object object)
          Checks whether two rectangle operations are equal.
 int getHeight()
          Returns the height of the rectangle
 int getWidth()
          Returns the width of the rectangle
 int getX()
          Returns the X coordinate of the left edge of the rectangle
 int getY()
          Returns the Y coordinate of the top edge of the rectangle
 int hashCode()
          Returns the hashcode for this rectangle operation.
 void setHeight(int height)
          Sets the height of the rectangle
 void setRectangle(int x, int y, int width, int height)
          Sets bounds of the rectangle.
 void setWidth(int width)
          Sets the width of the rectangle
 void setX(int x)
          Sets the X coordinate of the left edge of the rectangle.
 void setY(int y)
          Sets the Y coordinate of the top edge of the rectangle.
 
Methods inherited from class org.jdrawing.graphics.GraphicsOperation
contains, getBounds, getBounds2D, getPosition, getShapeOfOperation, getStyle, intersects, paint, paintOperation, setPosition, setStyle
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectangleOperation

public RectangleOperation(int x,
                          int y,
                          int width,
                          int height)
Returns RectangleOperation with given rectangle.

Parameters:
x - left edge of the rectangle
y - top edge of the rectangle
width - width of the rectangle
height - height of the rectangle

RectangleOperation

public RectangleOperation(int x,
                          int y,
                          int width,
                          int height,
                          Style style)
Returns RectangleOperation with given rectangle and style.

Parameters:
x - left edge of the rectangle
y - top edge of the rectangle
width - width of the rectangle
height - height of the rectangle
style - style for this rectangle
Method Detail

setX

public void setX(int x)
Sets the X coordinate of the left edge of the rectangle.

Parameters:
x - left edge of the rectangle

getX

public int getX()
Returns the X coordinate of the left edge of the rectangle

Returns:
the X coordinate of the left edge of the rectangle

setY

public void setY(int y)
Sets the Y coordinate of the top edge of the rectangle.

Parameters:
y - top edge of the rectangle

getY

public int getY()
Returns the Y coordinate of the top edge of the rectangle

Returns:
the Y coordinate of the top edge of the rectangle

setWidth

public void setWidth(int width)
Sets the width of the rectangle

Parameters:
width - width of the rectangle

getWidth

public int getWidth()
Returns the width of the rectangle

Returns:
width of the rectangle

setHeight

public void setHeight(int height)
Sets the height of the rectangle

Parameters:
height - height of the rectangle

getHeight

public int getHeight()
Returns the height of the rectangle

Returns:
height of the rectangle

setRectangle

public void setRectangle(int x,
                         int y,
                         int width,
                         int height)
Sets bounds of the rectangle.

Parameters:
x - left edge of the rectangle
y - top edge of the rectangle
width - width of the rectangle
height - height of the rectangle

equals

public boolean equals(java.lang.Object object)
Checks whether two rectangle operations are equal. The result is true if and only if the argument is not null and is a RectangleOperation object that has the same attributes as this RectangleOperation.

Overrides:
equals in class GraphicsOperation
Parameters:
object - the Object to compare with this RectangleOperation
Returns:
true if the objects are equal; false otherwise.

hashCode

public int hashCode()
Returns the hashcode for this rectangle operation.

Overrides:
hashCode in class GraphicsOperation
Returns:
a hash code for this rectangle operation.