public class UILabelComponent extends UILabelBaseComponent
This component allows you to input one line of text. You can use Minecraft's formatting using "[" symbol instead of section field.
This component can be created using IMappetUIBuilder.label(String)
method.
function main(c)
{
var ui = mappet.createUI().background();
var label = ui.label("Welcome, [l" + c.getSubject().getName() + "[r!");
label.rxy(0.5, 0.5).wh(100, 20).anchor(0.5);
label.color(0x00ee22).background(0x88000000).labelAnchor(0.5);
c.getSubject().openUI(ui);
}
Modifier and Type | Field and Description |
---|---|
float |
anchorX |
float |
anchorY |
java.lang.Integer |
background |
hasBackground, label
changedProperties, context, DELAY, enabled, h, id, keybinds, marginBottom, marginLeft, marginRight, marginTop, tooltip, tooltipDirection, updateDelay, visible, w, x, y
Constructor and Description |
---|
UILabelComponent() |
Modifier and Type | Method and Description |
---|---|
protected void |
applyProperty(UIContext context,
java.lang.String key,
GuiElement element) |
UILabelComponent |
background(int background)
Change background color of this label component by providing hex ARGB.
|
GuiElement |
create(Minecraft mc,
UIContext context) |
void |
deserializeNBT(NBTTagCompound tag) |
UILabelComponent |
labelAnchor(float anchor)
Change text's anchor point which determines where text will be rendered
relative to component's frame both vertically and horizontally.
|
UILabelComponent |
labelAnchor(float anchorX,
float anchorY)
Change text's anchor point which determines where text will be rendered
relative to component's frame, with separate vertical and horizontal
anchors.
|
void |
serializeNBT(NBTTagCompound tag) |
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 java.lang.Integer background
public float anchorX
public float anchorY
public UILabelComponent background(int background)
// Assuming that uiContext is a IMappetUIContext
// Add a half transparent black background
uiContext.get("label").background(0x88000000);
public UILabelComponent labelAnchor(float anchor)
// Assuming that uiContext is a IMappetUIContext
// Position the label's text in the middle of its frame
uiContext.get("label").labelAnchor(0.5);
public UILabelComponent labelAnchor(float anchorX, float anchorY)
// Assuming that uiContext is a IMappetUIContext
// Position the label's text in the middle only vertically
uiContext.get("label").labelAnchor(0, 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