Constructor and Description |
---|
Text(double x,
double y,
java.lang.String message)
Constructs a text at a given location.
|
Modifier and Type | Method and Description |
---|---|
void |
draw()
Shows this text on the canvas.
|
int |
getHeight()
Gets the height of the bounding box.
|
int |
getWidth()
Gets the width of the bounding box.
|
int |
getX()
Gets the leftmost x-position of the bounding box.
|
int |
getY()
Gets the topmost y-position of the bounding box.
|
void |
grow(double dw,
double dh)
Resizes this text both horizontally and vertically.
|
void |
paintShape(java.awt.Graphics2D g2)
Paints the shape.
|
void |
setColor(Color newColor)
Sets the color for drawing this text.
|
java.lang.String |
toString()
Yields a description of this shape.
|
void |
translate(double dx,
double dy)
Moves this text by a given amount.
|
public Text(double x, double y, java.lang.String message)
x
- the leftmost x-position of the shapey
- the topmost y-position of the shapemessage
- the text stringpublic int getX()
public int getY()
public int getWidth()
public int getHeight()
public void translate(double dx, double dy)
dx
- the amount by which to move in x-directiondy
- the amount by which to move in y-directionpublic void grow(double dw, double dh)
dw
- the amount by which to resize the width on each sidedh
- the amount by which to resize the height on each sidepublic void setColor(Color newColor)
newColor
- the new colorpublic void draw()
public java.lang.String toString()
Shape
public void paintShape(java.awt.Graphics2D g2)
Shape
paintShape
in interface Shape
g2
- the graphics object