public class TextShape extends Shape
Shape
. Provides
several constructors, to set its x and y location and color, in addition to
the required text.Constructor and Description |
---|
TextShape(int x,
int y,
java.lang.String text)
Builds a TextShape at the indicated x and y indices
|
TextShape(int x,
int y,
java.lang.String text,
java.awt.Color aColor)
Builds a TextShape at the indicated x and y indices to display the string
text with the text box color aColor
|
Modifier and Type | Method and Description |
---|---|
void |
draw(java.awt.Graphics2D g)
draw method (overriden)
|
java.awt.Font |
getFont()
getter for the font for the text of the shape
|
int |
getHeight()
getter for the height of the shape
|
java.lang.String |
getText()
getter for the text of the shape
|
int |
getWidth()
getter for the width of the shape
|
void |
setText(java.lang.String text)
setter for the text in the textshape
|
move, moveTo, onClick, onClick, onTimer, onTimer, remove, stopTimer
collidesWith, contains, getBackgroundColor, getBounds, getForegroundColor, getWindow, getX, getY, onClick, repaint, setBackgroundColor, setForegroundColor, setX, setY
public TextShape(int x, int y, java.lang.String text)
x
- - x coordinate for location of the TextShapey
- - y coordinate for location of the TextShapetext
- -string to be displayed in the the TextShapepublic TextShape(int x, int y, java.lang.String text, java.awt.Color aColor)
x
- - x coordinate for location of the TextShapey
- - y coordinate for location of the TextShapetext
- -string to be displayed in the the TextShapeaColor
- -color of the text boxpublic java.awt.Font getFont()
public java.lang.String getText()
public void setText(java.lang.String text)
text
- public int getWidth()
public int getHeight()