Package net.risingworld.api.ui
Klasse UILabel
java.lang.Object
net.risingworld.api.ui.UIElement
net.risingworld.api.ui.UILabel
- Alle implementierten Schnittstellen:
Serializable
Represents a label.
Example: Create a label in the upper center of the screen
- Siehe auch:
-
Feldübersicht
Von Klasse geerbte Felder net.risingworld.api.ui.UIElement
hoverStyle, style
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibunggetText()
Gets the currently set text of the label.boolean
Gets whether or not rich text is enabled and should be parsed.void
Sets a new font for this label.void
setFontColor
(float r, float g, float b, float a) Sets a font color for the label.void
setFontColor
(int rgba) Sets a font color for the label.void
setFontSize
(float size) Sets a font size for the label.void
setFontSize
(float size, Unit unit) Sets a font size for the label.void
Changes the origin of this element.void
setRichTextEnabled
(boolean set) Determines whether or not rich text tags should be supported (e.g tags like "<color>" etc).void
Sets the text for the label.void
setTextAlign
(TextAnchor anchor) Sets the alignment for the text.void
setTextWrap
(boolean wrap) Sets automatic text wrap for the label.Von Klasse geerbte Methoden net.risingworld.api.ui.UIElement
addChild, addStyleSheet, addToClassList, getChildCount, getChilds, getID, getParent, getPluginID, isClickable, onClick, removeAllChilds, removeChild, removeFromClassList, removeFromParent, removeStyleSheet, resetPivot, resetPosition, setBackgroundColor, setBackgroundColor, setBorder, setBorderColor, setBorderColor, setBorderEdgeRadius, setClickable, setOpacity, setPickable, setPosition, setSize, setVisible, updateStyle
-
Konstruktordetails
-
UILabel
public UILabel()Creates a new, empty label. -
UILabel
Creates a label containing the provided text.- Parameter:
text
- the text you want to set for the label.
-
-
Methodendetails
-
setText
Sets the text for the label.- Parameter:
text
- the new text you want to set.
-
getText
Gets the currently set text of the label.- Gibt zurück:
- the text of the label.
-
setRichTextEnabled
public void setRichTextEnabled(boolean set) Determines whether or not rich text tags should be supported (e.g tags like "<color>" etc).- Parameter:
set
- true to enable rich text tags (so they get parsed), false to disable them (so they will just be displayed like regular text). By default, rich text tags are enabled.
-
isRichTextEnabled
public boolean isRichTextEnabled()Gets whether or not rich text is enabled and should be parsed.- Gibt zurück:
- true if rich text should be parsed, false if not.
-
setFont
Sets a new font for this label.
Note: This is just a helper method. Internally it changes the style font property!- Parameter:
font
- the new font you want to set for this label.
-
setFontSize
public void setFontSize(float size) Sets a font size for the label.
Note: This is just a helper method. Internally it changes the style fontSize property!- Parameter:
size
- the new font size (pixels) you want to set for this label.
-
setFontSize
Sets a font size for the label.
Note: This is just a helper method. Internally it changes the style fontSize property!- Parameter:
size
- the new font size you want to set for this label.unit
- determines if the size is in pixels (absolute) or percent (relative).
-
setFontColor
public void setFontColor(float r, float g, float b, float a) Sets a font color for the label.
Note: This is just a helper method. Internally it changes the style color property!- Parameter:
r
- the new red component for the font color (0-1).g
- the new green component for the font color (0-1).b
- the new blue component for the font color (0-1).a
- the new alpha component (opacity) for the font color (0-1).
-
setFontColor
public void setFontColor(int rgba) Sets a font color for the label.
Note: This is just a helper method. Internally it changes the style color property!- Parameter:
rgba
- an int RGBA value describing the new color (e.g 0xFF0000FF for fully opaque red etc).
-
setTextAlign
Sets the alignment for the text.
Note: This is just a helper method. Internally it changes the style textAlign property!- Parameter:
anchor
- the anchor.- Example: Set centered text
-
setTextWrap
public void setTextWrap(boolean wrap) Sets automatic text wrap for the label.
Note: This is just a helper method. Internally it changes the style whiteSpace property!- Parameter:
wrap
- true to enable automatic text wrapping, false to disable it.
-
setPivot
Beschreibung aus Klasse kopiert:UIElement
Changes the origin of this element.
Note: This is just a helper method. Internally it only changes the style transformOrigin and translate values!
-