67 lines
1.5 KiB
Markdown
67 lines
1.5 KiB
Markdown
# UILabelComponent.labelAnchor
|
|
|
|
[← UILabelComponent](index.md) · [← Master](../../wiki.md)
|
|
|
|
Parça 2/2 · [önceki](labelAnchor.md)
|
|
|
|
uiContext.get("label").background(0x88000000);
|
|
|
|
|
|
labelAnchor
|
|
|
|
public 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.
|
|
|
|
// Assuming that uiContext is a IMappetUIContext
|
|
|
|
// Position the label's text in the middle of its frame
|
|
uiContext.get("label").labelAnchor(0.5);
|
|
|
|
|
|
labelAnchor
|
|
|
|
public 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.
|
|
|
|
// Assuming that uiContext is a IMappetUIContext
|
|
|
|
// Position the label's text in the middle only vertically
|
|
uiContext.get("label").labelAnchor(0, 0.5);
|
|
|
|
|
|
create
|
|
|
|
public GuiElement create(Minecraft mc,
|
|
UIContext context)
|
|
|
|
Specified by:
|
|
create in class UIComponent
|
|
|
|
applyProperty
|
|
|
|
protected void applyProperty(UIContext context,
|
|
java.lang.String key,
|
|
GuiElement element)
|
|
|
|
Overrides:
|
|
applyProperty in class UILabelBaseComponent
|
|
|
|
serializeNBT
|
|
|
|
public void serializeNBT(NBTTagCompound tag)
|
|
|
|
Overrides:
|
|
serializeNBT in class UILabelBaseComponent
|
|
|
|
deserializeNBT
|
|
|
|
public void deserializeNBT(NBTTagCompound tag)
|
|
|
|
Overrides:
|
|
deserializeNBT in class UILabelBaseComponent
|