Forms
Class Forms

java.lang.Object
  |
  +--Forms.Forms
Direct Known Subclasses:
MyCircle, MyPolygon, MyRectangle

public abstract class Forms
extends Object

This abstract class declares the basic methods for creating and manipulating forms.

Version:
1.0
Author:
Sebastien Baehni

Field Summary
protected  Rectangle rectangle
          This is the bounding rectangle.
 
Constructor Summary
Forms()
          The second constructor.
Forms(int xOrigin, int yOrigin, int width, int height)
          The first constructor.
 
Method Summary
 int height()
          This method returns the height of the bounding rectangle.
 void height(int height)
          We set the new height of the bounding rectangle.
abstract  boolean isSelected(int x, int y)
          Abstract method.
 void rectangle(Rectangle rectangle)
          This fonction set the bounding rectangle to a new rectangle in parameter.
abstract  void translate(int x, int y, int maxWidth, int maxHeight)
          Abstract method.
 int width()
          The width of the bounding rectangle.
 void width(int width)
          This methods set the new width of the bounding rectangle.
 int xOrigin()
          This method returns the x origin of the bounding rectangle.
 void xOrigin(int xOrigin)
          This method set the new x origin of the bounding rectangle.
 int yOrigin()
          This method returns the y origin of the bounding rectangle.
 void yOrigin(int yOrigin)
          This method set the new y origin of the bounding rectangle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rectangle

protected Rectangle rectangle
This is the bounding rectangle.
Constructor Detail

Forms

public Forms(int xOrigin,
             int yOrigin,
             int width,
             int height)
The first constructor.
Parameters:
xOrigin - The x origin of the bounding rectangle.
yOrigin - The y origin of the bounding rectangle.
width - The width of the bounding rectangle.
height - The height of the bounding rectangle.

Forms

public Forms()
The second constructor. It creates a new bounding rectangle with no parameters.
Method Detail

rectangle

public void rectangle(Rectangle rectangle)
This fonction set the bounding rectangle to a new rectangle in parameter.
Parameters:
rectangle - The new bounding rectangle.

xOrigin

public int xOrigin()
This method returns the x origin of the bounding rectangle.
Returns:
The x origin of the bounding rectangle.

xOrigin

public void xOrigin(int xOrigin)
This method set the new x origin of the bounding rectangle.
Parameters:
xOrigin - The new x origin.

yOrigin

public int yOrigin()
This method returns the y origin of the bounding rectangle.
Returns:
The y origin of the bounding rectangle.

yOrigin

public void yOrigin(int yOrigin)
This method set the new y origin of the bounding rectangle.
Parameters:
yOrigin - The new y origin.

width

public int width()
The width of the bounding rectangle.
Returns:
The width of the bounding rectangle.

width

public void width(int width)
This methods set the new width of the bounding rectangle.
Parameters:
width - The new width of the bounding rectangle.

height

public int height()
This method returns the height of the bounding rectangle.
Returns:
The height of the bounding rectangle.

height

public void height(int height)
We set the new height of the bounding rectangle.

isSelected

public abstract boolean isSelected(int x,
                                   int y)
Abstract method. The implementing classes must tell if the forms is selected or not with the specified point.
Parameters:
x - The x coordinate of the point.
y - The y coordinate of the point.
Returns:
True if the point is in the forms false otherwise.

translate

public abstract void translate(int x,
                               int y,
                               int maxWidth,
                               int maxHeight)
Abstract method. The implementing classes can translate themselves.
Parameters:
x - The x point coordinate where the implementing classes must translate.
y - The y point coordinate where the implementing classes must translate.
maxWidth - The forms can be translated util maxWidth (after they go out of the window scope).
maxHeight - The forms can be translated util maxHeight (after they go out of the window scope).