be.yildizgames.common.util.Registerable, Elementpublic abstract class AbstractTextElement extends BaseElement
Element.AlignmentMAX_OPACITY, virtualHeight| Modifier | Constructor | Description |
|---|---|---|
protected |
AbstractTextElement(BaseCoordinate coordinates,
Font textFont) |
Full constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
static AbstractTextElement |
getByName(String name) |
|
Font |
getFont() |
|
int |
getFontHeight() |
|
float |
getLastLineWidth() |
Compute the last text width, if the text is multi line.
|
String |
getText() |
|
int |
getTextHeight() |
|
int |
getTextWidth() |
Compute the width in pixel of the printed text.
|
protected void |
removeFromRegisterer() |
Remove the element from registered elements.
|
abstract void |
setColor(Color color) |
Set the text color.
|
void |
setFont(Font newFont) |
|
protected abstract void |
setFontImpl(Font newFont) |
Internal method, do not use externally.
|
boolean |
setText(String newText) |
Overload the setText method to avoid the toString call.
|
protected abstract void |
setTextImpl(String newText) |
Internal method, do not use externally.
|
addToLeft, addToPosition, addToTop, delete, getBottom, getCoordinates, getHeight, getLeft, getOpacity, getRight, getTop, getWidth, hide, hideImpl, isVisible, multiplySize, resetVirtualHeight, setCoordinates, setHeight, setLeft, setLeft, setLeft, setLeft, setPosition, setPosition, setPosition, setPositionImpl, setSize, setSize, setSizeImpl, setTop, setTop, setTop, setTop, setVirtualHeight, setVisible, setWidth, show, showImpl, updateAddPositionValueequals, getName, hashCode, toStringprotected AbstractTextElement(BaseCoordinate coordinates, Font textFont)
coordinates - Text position and size.textFont - Font to use to print the text.public static AbstractTextElement getByName(String name)
public final int getTextWidth()
public final float getLastLineWidth()
protected final void removeFromRegisterer()
public final int getTextHeight()
public final String getText()
public final boolean setText(String newText)
newText - New text to print.true if the text was updated.public final int getFontHeight()
public final Font getFont()
public final void setFont(Font newFont)
newFont - New font.protected abstract void setTextImpl(String newText)
newText - New text to print.protected abstract void setFontImpl(Font newFont)
newFont - New font to use.public abstract void setColor(Color color)
color - Color to set to this text.Copyright © 2014–2018. All rights reserved.