ClickAction
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 | 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
|
TextShape(int x,
int y,
java.lang.String text,
java.awt.Color aColor,
int aSize) |
Builds a TextShape at the indicated x and y indices to display the string
text with the text box color aColor
|
TextShape(int x,
int y,
java.lang.String text,
java.awt.Color aColor,
int aSize,
java.lang.String aFontType) |
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 | 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 |
getFontSize() |
getter for the font size for the text of the shape
doesn't make sense to have a setter
for this after string is written
|
java.lang.String |
getFontType() |
getter for the font type for the text of the shape
doesn't make sense to have a setter
for this after string is written, that's
in the constructor
|
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
|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, 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 TextShape(int x, int y, java.lang.String text, java.awt.Color aColor, int aSize)
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 boxaSize
- -size of the fontpublic TextShape(int x, int y, java.lang.String text, java.awt.Color aColor, int aSize, java.lang.String aFontType)
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 boxaSize
- -size of the fontpublic java.lang.String getFontType()
public int getFontSize()
public 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 Shape
g
- graphics object from SwingShape.draw(java.awt.Graphics2D)