public class UITextComponent extends UILabelBaseComponent
This component allows you to input lots of text. This text can have multiple lines and Minecraft's formatting using "[" symbol instead of section field. Beside that this text component is resizable inside of column and row elements so it should work perfectly with layouts.
This component can be created using IMappetUIBuilder.text(String)
method.
function main(c)
{
var ui = mappet.createUI().background();
var scroll = ui.column(5, 10);
scroll.getCurrent().scroll().rxy(0.5, 0.5).w(200).rh(0.8).anchor(0.5);
var text = scroll.text("Lorem ipsum dolor sit amet,\n\n" +
"consectetur adipiscing elit. Nullam sit amet luctus tellus. Sed posuere, orci quis vehicula mattis, orci nulla malesuada nunc, in mattis mi urna a quam. Mauris malesuada tempus molestie. Pellentesque in est quam. Sed iaculis dictum bibendum. Cras eleifend varius ligula, id luctus arcu ultricies a. Nam tincidunt mauris eu ligula sodales faucibus sed ut eros. Phasellus consectetur nec magna quis fermentum. Donec quis mauris tristique neque suscipit placerat. Etiam id laoreet ante. Maecenas finibus nec augue vitae convallis.\n\n" +
"Donec at tortor nibh. Nunc quis nulla justo. Vestibulum lacinia quis sapien at euismod. Curabitur sed maximus sapien. Fusce sed dui at lectus venenatis volutpat ac ac sapien. Cras at tortor pellentesque, finibus nulla vitae, tristique ligula. Etiam porta elementum justo. Cras facilisis rutrum mauris ac consectetur. Aliquam ipsum dolor, accumsan et lacus malesuada, volutpat pretium odio. Donec sed purus vulputate, auctor nulla in, sagittis ipsum. Nam dolor tortor, consequat sit amet eleifend at, imperdiet at ligula. Aenean blandit sem sit amet ex vehicula consequat. Etiam feugiat condimentum sem, eget imperdiet augue mattis quis.");
c.getSubject().openUI(ui);
}
Modifier and Type | Field and Description |
---|---|
float |
textAnchor |
hasBackground, label
changedProperties, context, DELAY, enabled, h, id, keybinds, marginBottom, marginLeft, marginRight, marginTop, tooltip, tooltipDirection, updateDelay, visible, w, x, y
Constructor and Description |
---|
UITextComponent() |
Modifier and Type | Method and Description |
---|---|
protected void |
applyProperty(UIContext context,
java.lang.String key,
GuiElement element) |
GuiElement |
create(Minecraft mc,
UIContext context) |
void |
deserializeNBT(NBTTagCompound tag) |
void |
serializeNBT(NBTTagCompound tag) |
UITextComponent |
textAnchor(float anchor)
Change text's anchor point which determines where text will
be rendered relative to component's frame horizontally.
|
apply, color, color, getLabel, label
anchor, anchor, anchorX, anchorY, applyKeybinds, change, clearChanges, context, context, createContext, enabled, getChanges, getChildComponents, getDefaultUpdateDelay, h, handleChanges, id, isDataReserved, keybind, keybind, keybind, keybind, margin, marginBottom, marginLeft, marginRight, marginTop, populateData, resetContext, rh, rh, rw, rw, rwh, rx, rx, rxy, ry, ry, serializeNBT, tooltip, tooltip, updateDelay, visible, w, wh, x, xy, y
public UITextComponent textAnchor(float anchor)
// Assuming that uiContext is a IMappetUIContext
// Position the text's content in the center of its frame
uiContext.get("text").textAnchor(0.5);
public GuiElement create(Minecraft mc, UIContext context)
create
in class UIComponent
protected void applyProperty(UIContext context, java.lang.String key, GuiElement element)
applyProperty
in class UILabelBaseComponent
public void serializeNBT(NBTTagCompound tag)
serializeNBT
in class UILabelBaseComponent
public void deserializeNBT(NBTTagCompound tag)
deserializeNBT
in class UILabelBaseComponent