public class UILabel extends UIComponent<UILabel> implements IScrollable, IBBCodeRenderer<UILabel>
ITransformable.Alpha, ITransformable.Brightness, ITransformable.Color, ITransformable.Position<T>, ITransformable.Rotate, ITransformable.Scale, ITransformable.Size<T>, ITransformable.Translate
Modifier and Type | Field and Description |
---|---|
protected BBCodeRenderer |
bbRenderer
BBCode renderer
|
protected BBString |
bbText
BBCode for this
UILabel |
protected int |
color
Color to use to draw the text of this
UILabel . |
protected boolean |
drawShadow
Determines if the text is drawn with drop shadow.
|
protected float |
fontScale
Font scale used to draw the text *.
|
protected int |
lineOffset
Number of line offset out of this
UILabel when drawn. |
protected java.util.List<java.lang.String> |
lines
List of strings making the text of this
UILabel |
protected int |
lineSpacing
Space used between each line.
|
protected boolean |
multiLine
Whether this
UITextField handles multiline text. |
protected UISlimScrollbar |
scrollBar
Scrollbar of the textfield
|
protected java.lang.String |
text
Text of this
UILabel . |
protected int |
textHeight
Height of the text.
|
protected int |
textWidth
Width of the text.
|
Constructor and Description |
---|
UILabel(MalisisGui gui)
Instantiates a new
UILabel . |
UILabel(MalisisGui gui,
BBString text)
Instantiates a new
UILabel . |
UILabel(MalisisGui gui,
boolean multiLine)
Instantiates a new
UILabel . |
UILabel(MalisisGui gui,
java.lang.String text)
Instantiates a new
UILabel . |
UILabel(MalisisGui gui,
java.lang.String text,
boolean multiLine)
Instantiates a new
UILabel . |
Modifier and Type | Method and Description |
---|---|
protected void |
buildLines()
Builds the lines for this
UILabel . |
protected void |
calculateSize()
Calculate the size of this
UILabel . |
void |
drawBackground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Draws the background.
|
void |
drawForeground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Draws the foreground.
|
BBString |
getBBText()
Gets the BB text of this
UILabel . |
UIComponent |
getComponentAt(int x,
int y)
Gets the component at.
|
int |
getContentHeight() |
int |
getContentWidth() |
float |
getFontScale()
Gets the font scale for this
UILabel . |
int |
getHorizontalPadding() |
int |
getLineHeight() |
float |
getOffsetX() |
float |
getOffsetY() |
java.lang.String |
getPropertyString()
Gets the property string.
|
float |
getScrollStep() |
int |
getStartLine() |
java.lang.String |
getText()
Gets the text of this
UILabel . |
int |
getVerticalPadding() |
int |
getVisibleLines() |
void |
onSizeChange(SpaceChangeEvent.SizeChangeEvent<UILabel> event) |
UILabel |
setColor(int color)
Sets the color of the text of this
UILabel . |
UILabel |
setDrawShadow(boolean drawShadow)
Set the drop shadow for the text of this
UILabel . |
UILabel |
setFontScale(float scale)
Sets the scale of the font to use for this
UILabel . |
void |
setOffsetX(float offsetX,
int delta) |
void |
setOffsetY(float offsetY,
int delta) |
UILabel |
setText(BBString str) |
UILabel |
setText(java.lang.String text)
Sets the text of this
UILabel . |
addControlComponent, componentX, componentY, draw, fireEvent, getAlpha, getAnchor, getGui, getHeight, getName, getParent, getRawHeight, getRawWidth, getTooltip, getWidth, getX, getY, getZIndex, isDisabled, isFocused, isHovered, isInsideBounds, isRelativeHeight, isRelativeWidth, isVisible, onAddedToScreen, onButtonPress, onButtonRelease, onClick, onDoubleClick, onDrag, onKeyTyped, onMouseMove, onRightClick, onScrollWheel, parentX, parentY, register, relativeX, relativeY, removeAllControlComponents, removeControlComponent, screenX, screenY, setAlpha, setAnchor, setDisabled, setFocused, setHovered, setName, setParent, setPosition, setPosition, setSize, setTooltip, setTooltip, setVisible, setZIndex, toString, unregister
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getHeight, getWidth
protected java.lang.String text
UILabel
.protected BBCodeRenderer bbRenderer
protected java.util.List<java.lang.String> lines
UILabel
protected boolean multiLine
UITextField
handles multiline text.protected int lineOffset
protected int lineSpacing
protected float fontScale
protected UISlimScrollbar scrollBar
protected int color
UILabel
.protected boolean drawShadow
protected int textWidth
protected int textHeight
public UILabel(MalisisGui gui, java.lang.String text, boolean multiLine)
UILabel
.gui
- the guitext
- the textmultiLine
- the multi linepublic UILabel(MalisisGui gui, BBString text)
UILabel
.gui
- the guitext
- the textpublic UILabel(MalisisGui gui, java.lang.String text)
UILabel
.gui
- the guitext
- the textpublic UILabel(MalisisGui gui, boolean multiLine)
UILabel
.gui
- the guimultiLine
- the multi linepublic UILabel(MalisisGui gui)
UILabel
.gui
- the guipublic java.lang.String getText()
UILabel
.public UILabel setText(java.lang.String text)
UILabel
.multiLine
is false, the width is recalculated.multiLine
is true, the lines
will be recreated.text
- the textUILabel
public UILabel setColor(int color)
UILabel
.color
- the colorpublic UILabel setDrawShadow(boolean drawShadow)
UILabel
.drawShadow
- the draw shadowpublic UILabel setFontScale(float scale)
UILabel
.scale
- the scalepublic float getFontScale()
UILabel
.getFontScale
in interface IBBCodeRenderer<UILabel>
public int getContentWidth()
getContentWidth
in interface IScrollable
public int getContentHeight()
getContentHeight
in interface IScrollable
public float getOffsetX()
getOffsetX
in interface IScrollable
public void setOffsetX(float offsetX, int delta)
setOffsetX
in interface IScrollable
public float getOffsetY()
getOffsetY
in interface IScrollable
public void setOffsetY(float offsetY, int delta)
setOffsetY
in interface IScrollable
public float getScrollStep()
getScrollStep
in interface IScrollable
public int getVerticalPadding()
getVerticalPadding
in interface IScrollable
public int getHorizontalPadding()
getHorizontalPadding
in interface IScrollable
public BBString getBBText()
UILabel
.getBBText
in interface IBBCodeRenderer<UILabel>
public UILabel setText(BBString str)
setText
in interface IBBCodeRenderer<UILabel>
public int getStartLine()
getStartLine
in interface IBBCodeRenderer<UILabel>
public int getVisibleLines()
getVisibleLines
in interface IBBCodeRenderer<UILabel>
public int getLineHeight()
getLineHeight
in interface IBBCodeRenderer<UILabel>
public UIComponent getComponentAt(int x, int y)
getComponentAt
in class UIComponent<UILabel>
x
- the xy
- the yprotected void buildLines()
protected void calculateSize()
UILabel
.public void drawBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
drawBackground
in class UIComponent<UILabel>
renderer
- the renderermouseX
- the mouse xmouseY
- the mouse ypartialTick
- the partial tickpublic void drawForeground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
drawForeground
in class UIComponent<UILabel>
renderer
- the renderermouseX
- the mouse xmouseY
- the mouse ypartialTick
- the partial tickpublic void onSizeChange(SpaceChangeEvent.SizeChangeEvent<UILabel> event)
public java.lang.String getPropertyString()
UIComponent
getPropertyString
in class UIComponent<UILabel>