|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectm865.shapepack.ShapeFactory
public class ShapeFactory
The ShapeFactory class is a factory class which provides a catalog of the shapes it can make and two creation methods which will construct any shape in the catalog.
Field Summary | |
---|---|
protected static java.lang.String |
ELLIPSE
|
protected static java.lang.String |
RECTANGLE
|
protected static java.lang.String |
SQUARE
|
protected java.lang.String[] |
theList
The list containing the names of the shapes that this factory knows how to make. |
Constructor Summary | |
---|---|
ShapeFactory()
|
Method Summary | |
---|---|
Shape |
createShape(java.lang.String shapeName,
int x,
int y)
Creates a specified shape with a default color and a bounding box of the default size. |
Shape |
createShape(java.lang.String shapeName,
int x,
int y,
int w,
int h,
java.awt.Color c)
Creates a specified shape |
java.lang.String[] |
getTheList()
|
static void |
main(java.lang.String[] args)
Provides a unit test. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String RECTANGLE
protected static final java.lang.String ELLIPSE
protected static final java.lang.String SQUARE
protected java.lang.String[] theList
Constructor Detail |
---|
public ShapeFactory()
Method Detail |
---|
public java.lang.String[] getTheList()
public Shape createShape(java.lang.String shapeName, int x, int y, int w, int h, java.awt.Color c)
shapeName
- the name of the shape.x
- the horizontal coordinate of the upper left corner of the bounding box.y
- the vertical coordinate of the upper left corner of the bounding box.w
- the width of the bounding box.h
- the height of the bounding box.c
- the fill color of the shape.
public Shape createShape(java.lang.String shapeName, int x, int y)
shapeName
- the name of the shape.x
- the horizontal coordinate of the upper left corner of the bounding box.y
- the vertical coordinate of the upper left corner of the bounding box.
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |