TextComponent

public class TextComponent extends GuiComponent(source)

A gui element which renders a string in a single line

Constructors

Link copied to clipboard
public void TextComponent(String string, int width, TextComponent.TextAlignment alignment)
public void TextComponent(String string, int width)
public void TextComponent(String string)

Types

Link copied to clipboard
public enum TextAlignment

Functions

Link copied to clipboard
public void blur()
Unfocus this element only if this element is selected.
Link copied to clipboard
public T foldChildren<T>(T initial, @NotNull() @NotNull() BiFunction<@NotNull() GuiComponent, T, T> visitor)
Walk over the direct children of this element.
Link copied to clipboard
public final T foldRecursive<T>(T initial, @NotNull() @NotNull() BiFunction<@NotNull() GuiComponent, T, T> visitor)
Walk the scene tree of this gui element, including children of children.
Link copied to clipboard
public int getHeight()
Get the requested y size for this element.
Link copied to clipboard
public int getWidth()
Get the requested x size for this element.
Link copied to clipboard
public boolean isFocused()
Test if this element is focused.
Link copied to clipboard
public boolean isInFocus()
Test if this element is focused, or has a focused child.
Link copied to clipboard
public boolean keyboardEvent(@NotNull() @NotNull() KeyboardEvent event, @NotNull() @NotNull() GuiImmediateContext context)
Called by the parent renderer.
Link copied to clipboard
public boolean mouseEvent(@NotNull() @NotNull() MouseEvent mouseEvent, @NotNull() @NotNull() GuiImmediateContext context)
Called by the parent renderer.
Link copied to clipboard
public void onGainedFocus()
This method is called by the gui context when an element gains focus.
Link copied to clipboard
public void onLostFocus()
This method is called by the gui context when an element loses focus.
Link copied to clipboard
public void render(GuiImmediateContext context)
Called by the parent renderer.
Link copied to clipboard
public void requestFocus()
Call this method to request focus in the current gui context.
Link copied to clipboard
public void setContext(GuiContext context)
Link copied to clipboard
public void setFocus(boolean shouldFocus)
Focuses or blurs this element depending on shouldFocus
Link copied to clipboard
public List<String> split(String text, int width)