|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--jdraw.graphics.GraphicObject
|
+--jdraw.graphics.LineObject
Class LineObject is the GraphicObject extension which holds a single line shape.
| Field Summary | |
protected java.awt.Point |
firstPoint
Need to save a reference to initial point. |
| Fields inherited from class jdraw.graphics.GraphicObject |
arrowsOn, backgroundColor, color, controlPoints, graphicType, paint, shape, stroke |
| Constructor Summary | |
LineObject(java.awt.Color c,
java.awt.Color bgc,
java.util.Vector p,
java.util.Vector cPoints,
java.awt.BasicStroke bs,
int arrows)
Construct this with the given Shape, Color, FillStyle, and ControlPoints objects. |
|
LineObject(java.awt.Point pt1,
java.awt.Point pt2,
java.awt.Color c,
java.awt.Color bgc,
java.util.Vector p,
java.awt.BasicStroke bs,
int arrows)
Construct this with the given Points, Colors, FillStyle, BasicStroke objects. |
|
| Method Summary | |
java.lang.Object |
clone()
Returns a derived copy of this. |
java.awt.geom.GeneralPath |
deriveImage(float zoom)
Method deriveImage creates the GeneralPath object which will represent this shape on screen, given the passed in zoom factor. |
void |
draw(java.awt.Graphics2D g2D,
float zoom)
Draws this.shape on the given Graphics2D object. |
java.util.Vector |
getSaveBundle()
Returns a saveBundle (Vector) derived from the information contained in this. |
boolean |
isPointOnShape(java.awt.Point clickedPoint)
Returns a boolean value representing whether the given Point resides on this.shape. |
void |
setArrows(int arrows)
Empty method which is overwritten in Line, Polyline, and Curve. |
void |
setControlPoints()
Sets this.controlPoints based on the current PathIterator of this.shape. |
void |
setSecondPoint(java.awt.Point pt2)
Sets the opposite corner of the Shape from firstPoint. |
void |
setShape()
Sets this.shape based on the points currently in this.controlPoints. |
void |
translate(float deltaX,
float deltaY)
Translates the position of this.shape by the given deltaX and deltaY values. |
| Methods inherited from class jdraw.graphics.GraphicObject |
addPoint, containedIn, flipHorizontally, flipVertically, getBackgroundColor, getColor, getControlPoints, getGraphicType, getMaxX, getMaxY, getMinX, getMinY, getShape, getStroke, getTouchedControlPoint, rotate, setBackgroundColor, setColor, setHorizontalCenter, setLastPoint, setMaxX, setMaxY, setMinX, setMinY, setPaint, setStroke, setVerticalCenter, translateControlPoint |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.awt.Point firstPoint
| Constructor Detail |
public LineObject(java.awt.Color c,
java.awt.Color bgc,
java.util.Vector p,
java.util.Vector cPoints,
java.awt.BasicStroke bs,
int arrows)
c - - The Color object to store in this.color.bgc - - The Color object to store in this.backgroundColor.p - - The Vector to store in this.paint.cPoints - - Vector object to store in this.controlPoints.bs - - The BasicStroke object to store in this.stroke.arrows - - The int value indicating which (if any) arrow heads
to draw.
public LineObject(java.awt.Point pt1,
java.awt.Point pt2,
java.awt.Color c,
java.awt.Color bgc,
java.util.Vector p,
java.awt.BasicStroke bs,
int arrows)
pt1 - - The Point object at which to start the GeneralPath.pt2 - - The Point object at the opposite corner of the shape from pt1c - - The Color object to store in this.color.bgc - - The Color object to store in this.backgroundColor.p - - The Vector to store in this.paint.bs - - The BasicStroke object to store in this.stroke.arrows - - The int value indicating which (if any) arrow heads
to draw.| Method Detail |
public java.lang.Object clone()
clone in class GraphicObjectpublic void setSecondPoint(java.awt.Point pt2)
setSecondPoint in class GraphicObjectpt2 - - The Point object used with firstPoint to build this.shape.public boolean isPointOnShape(java.awt.Point clickedPoint)
isPointOnShape in class GraphicObjectclickedPoint - - The Point object represent the position of a mouse click.
public void draw(java.awt.Graphics2D g2D,
float zoom)
draw in class GraphicObjectg2D - - The Graphics2D object on which to draw this.shape.public void setShape()
setShape in class GraphicObjectpublic java.awt.geom.GeneralPath deriveImage(float zoom)
deriveImage in class GraphicObjectzoom - - The float value indicating the current zoom factor.public java.util.Vector getSaveBundle()
getSaveBundle in class GraphicObjectpublic void setControlPoints()
setControlPoints in class GraphicObject
public void translate(float deltaX,
float deltaY)
translate in class GraphicObjectdeltaX - - The int value by which to alter the X position of this.shape.deltaY - - The int value by which to alter the Y position of this.shape.public void setArrows(int arrows)
GraphicObjectsetArrows in class GraphicObjectarrows - - The int value to be copied to this.arrowsOn.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||