Module technology.sola.engine
Class TextGuiElement
java.lang.Object
technology.sola.engine.graphics.gui.GuiElement<TextStyles,TextGuiElement>
technology.sola.engine.graphics.gui.elements.TextGuiElement
TextGuiElement is a
GuiElement
that renders text for a GUI. It does not render child elements.-
Field Summary
Fields inherited from class technology.sola.engine.graphics.gui.GuiElement
children, contentBounds, styleContainer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendChildren
(GuiElement<?, ?>... children) TextGuiElement does not render children so this method will do nothing.Calculates content dimensions for this element.List<GuiElement<?,
?>> TextGuiElement does not render children so this method will return an empty List.@Nullable String
getText()
boolean
TextGuiElement is not focusable so this will return false.removeChild
(GuiElement<?, ?> child) TextGuiElement does not render children so this method will do nothing.void
renderContent
(Renderer renderer) Method to render the main content of the gui element (not borders, backgrounds, etc.).Sets the text that will be rendered.Methods inherited from class technology.sola.engine.graphics.gui.GuiElement
addStyle, addStyle, addStyles, events, findElementById, findElementsByType, findFocussedChildIndex, getAssetLoaderProvider, getBounds, getContentBounds, getFocusableChildren, getId, getParent, invalidateLayout, isActive, isFocussed, isHovered, isLayoutChanged, render, renderChildren, requestFocus, setId, styles
-
Constructor Details
-
TextGuiElement
public TextGuiElement()
-
-
Method Details
-
renderContent
Description copied from class:GuiElement
Method to render the main content of the gui element (not borders, backgrounds, etc.).- Specified by:
renderContent
in classGuiElement<TextStyles,
TextGuiElement> - Parameters:
renderer
- theRenderer
instance
-
calculateContentDimensions
Description copied from class:GuiElement
Calculates content dimensions for this element. If its dimensions are derived from only its children then it should return null.- Specified by:
calculateContentDimensions
in classGuiElement<TextStyles,
TextGuiElement> - Returns:
- the dimensions of the content of this element or null if only children dimensions matter
-
isFocusable
public boolean isFocusable()TextGuiElement is not focusable so this will return false.- Overrides:
isFocusable
in classGuiElement<TextStyles,
TextGuiElement> - Returns:
- false
-
appendChildren
TextGuiElement does not render children so this method will do nothing.- Overrides:
appendChildren
in classGuiElement<TextStyles,
TextGuiElement> - Parameters:
children
- the child elements to add- Returns:
- this
-
removeChild
TextGuiElement does not render children so this method will do nothing.- Overrides:
removeChild
in classGuiElement<TextStyles,
TextGuiElement> - Parameters:
child
- the child element that will not be removed- Returns:
- this
-
getChildren
TextGuiElement does not render children so this method will return an empty List.- Overrides:
getChildren
in classGuiElement<TextStyles,
TextGuiElement> - Returns:
- empty List
-
getText
- Returns:
- the text that will be rendered
-
setText
Sets the text that will be rendered.- Parameters:
text
- the new text to be rendered- Returns:
- this
-