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 (overridden)
|
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
|
equals, move, moveTo, onClick, onClick, onTimer, onTimer, remove, stopTimercollidesWith, contains, getBackgroundColor, getBounds, getForegroundColor, getWindow, getX, getY, onClick, repaint, setBackgroundColor, setForegroundColor, setX, setYpublic 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 - the text to put in the textShapepublic int getWidth()
public int getHeight()
public void draw(java.awt.Graphics2D g)
draw in class Shapeg - graphics object from SwingShape.draw(java.awt.Graphics2D)