|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--jdraw.graphics.GraphicObject
|
+--jdraw.graphics.TextObject
Class RectangleObject is the GraphicObject extension which holds a rectangle shape.
| Field Summary | |
protected double |
angle
The angle by which to rotate the text (in radians). |
protected java.awt.Font |
font
The Font with which to write the text. |
protected java.awt.geom.Point2D.Double |
location
The location of the upper-left hand corner of the box. |
protected java.lang.String |
text
The string of the text. |
| Fields inherited from class jdraw.graphics.GraphicObject |
arrowsOn, backgroundColor, color, controlPoints, graphicType, paint, shape, stroke |
| Constructor Summary | |
TextObject(java.awt.Color c,
java.awt.Color bgc,
java.util.Vector p,
java.util.Vector cPoints,
java.awt.BasicStroke bs,
java.lang.String t,
java.awt.Font font,
double theta)
Construct this with the given Shape, Color, FillStyle, and ControlPoints objects. |
|
TextObject(java.awt.geom.Point2D.Double pt1,
java.awt.Color c,
java.awt.Color bgc,
java.util.Vector p,
java.awt.BasicStroke bs,
java.lang.String t,
java.awt.Font font,
double theta)
Construct this with the given Points, Colors, FillStyle, BasicStroke objects. |
|
| Method Summary | |
void |
appendText(char c)
Appends character c onto the end of text. |
java.lang.Object |
clone()
returns - A copy of this. |
void |
deleteChar()
Removes the last character from text. |
void |
draw(java.awt.Graphics2D g2D,
float zoom)
Draws this text object to the screen. |
int |
getMaxX()
Returns the int X value of the right side of the Rectangle which bounds this.shape. |
int |
getMaxY()
Returns the int Y value of the bottom side of the Rectangle which bounds this.shape. |
int |
getMinX()
Returns the int X value of the left side of the Rectangle which bounds this.shape. |
int |
getMinY()
Returns the int Y value of the top side of the Rectangle which bounds this.shape. |
java.util.Vector |
getSaveBundle()
Returns a Vector with all the necessary save information. |
java.awt.Rectangle |
getTextSize(java.awt.Font tempFont,
java.awt.geom.Point2D.Double topLeft)
Returns the Rectangle which bounds the string this.text, when written with this.font. |
boolean |
isPointOnShape(java.awt.Point clickedPoint)
Returns a boolean value representing whether the given Point resides on this.shape. |
void |
rotate(double theta,
double anchorX,
double anchorY)
Rotates this.location around point (anchorX, anchorY) by theta radians. |
void |
setControlPoints()
Sets this.controlPoints based on the current PathIterator of this.shape. |
void |
setFont(java.awt.Font f)
Sets this.font given the new font type 'f'. |
void |
setFontSize(int size)
Sets this.font given the new font size 'size'. |
void |
setFontStyle(int style)
Sets this.font given the new font style 'style'. |
void |
setMaxX(int newMaxX)
Sets the int newMaxX value as the right side of the Rectangle which bounds this.shape. |
void |
setMaxY(int newMaxY)
Sets the int newMaxY value as the bottom side of the Rectangle which bounds this.shape. |
void |
setMinX(int newMinX)
Sets the int newMinX value as the left side of the Rectangle which bounds this.shape. |
void |
setMinY(int newMinY)
Sets the int newMinY value as the top side of the Rectangle which bounds this.shape. |
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. |
void |
translateControlPoint(int a,
int b,
int c)
translateControlPoint(int, int, int) is disabled for a TextObject. |
| Methods inherited from class jdraw.graphics.GraphicObject |
addPoint, containedIn, deriveImage, flipHorizontally, flipVertically, getBackgroundColor, getColor, getControlPoints, getGraphicType, getShape, getStroke, getTouchedControlPoint, setArrows, setBackgroundColor, setColor, setHorizontalCenter, setLastPoint, setPaint, setSecondPoint, 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.geom.Point2D.Double location
protected java.lang.String text
protected double angle
protected java.awt.Font font
| Constructor Detail |
public TextObject(java.awt.Color c,
java.awt.Color bgc,
java.util.Vector p,
java.util.Vector cPoints,
java.awt.BasicStroke bs,
java.lang.String t,
java.awt.Font font,
double theta)
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.font - - The Font object to store in this.font.theta - - The double value to store in this.angle.
public TextObject(java.awt.geom.Point2D.Double pt1,
java.awt.Color c,
java.awt.Color bgc,
java.util.Vector p,
java.awt.BasicStroke bs,
java.lang.String t,
java.awt.Font font,
double theta)
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.font - - The Font object to store in this.font.theta - - The double value to store in this.angle.| Method Detail |
public java.lang.Object clone()
clone in class GraphicObjectpublic void setShape()
setShape in class GraphicObjectpublic void setControlPoints()
setControlPoints in class GraphicObject
public void draw(java.awt.Graphics2D g2D,
float zoom)
draw in class GraphicObjectjdraw.graphics.GraphicObjectg2D - - The Graphics2D object on which to draw this.shape.zoom - - The float value indicating the current zoom factor.
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 appendText(char c)
c - - The char to be appended to the string.public void deleteChar()
public java.awt.Rectangle getTextSize(java.awt.Font tempFont,
java.awt.geom.Point2D.Double topLeft)
public java.util.Vector getSaveBundle()
getSaveBundle in class GraphicObjectpublic void setFont(java.awt.Font f)
f - - The Font object used to derive this.font.public void setFontSize(int size)
size - - The int value used as the size of this.font.public void setFontStyle(int style)
style - - The int value representing the style of this.font.
public void rotate(double theta,
double anchorX,
double anchorY)
rotate in class GraphicObjecttheta - - The double value representing an angle in radians.anchorX - - The double value of the x-coordinate of a point.anchorY - - The double value of the y-coordinate of a point.public boolean isPointOnShape(java.awt.Point clickedPoint)
isPointOnShape in class GraphicObjectclickedPoint - - The Point object represent the position of a mouse click.public int getMinX()
getMinX in class GraphicObjectpublic int getMinY()
getMinY in class GraphicObjectpublic int getMaxX()
getMaxX in class GraphicObjectpublic int getMaxY()
getMaxY in class GraphicObjectpublic void setMinX(int newMinX)
setMinX in class GraphicObjectnewMinX - - The int value to be set as the left side of the Rectangle
which bounds this.shape.public void setMinY(int newMinY)
setMinY in class GraphicObjectnewMinY - - The int value to be set as the top side of the Rectangle
which bounds this.shape.public void setMaxX(int newMaxX)
setMaxX in class GraphicObjectnewMaxX - - The int value to be set as the right side of the Rectangle
which bounds this.shape.public void setMaxY(int newMaxY)
setMaxY in class GraphicObjectnewMaxY - - The int value to be set as the bottom side of the Rectangle
which bounds this.shape.
public void translateControlPoint(int a,
int b,
int c)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||