1.8 KiB
UIStringListComponent — giriş
← UIStringListComponent · ← Master
Parça 1/2 · sonraki
mchorse.mappet.api.ui.components
Class UIStringListComponent java.lang.Object
mchorse.mappet.api.ui.components.UIComponent mchorse.mappet.api.ui.components.UIStringListComponent
public class UIStringListComponent extends UIComponent
String list UI component.
This component allows users to pick a string out of a list of strings that you provided.
The value that gets written to UI context's data (if ID is present) is the selected string that picked in the list.
This component can be created using IMappetUIBuilder.stringList(List) method.
function main(c) { var s = c.getSubject(); var ui = mappet.createUI(c, "handler").background(); var strings = ui.stringList(["Apple", "Orange", "Pineapple", "Avocado"]).id("strings").tooltip("Pick a fruit..."); var label = ui.label("...").id("fruit").visible(false);
strings.background(0x88000000).rxy(0.5, 0.5).wh(100, 240).anchor(0.5); label.rx(0.5).ry(0.5, -160).anchor(0.5, 0.5); label.background(0x88000000).labelAnchor(0.5, 0.5); s.openUI(ui); }
function handler(c) { var uiContext = c.getSubject().getUIContext(); var data = uiContext.getData();
if (uiContext.getLast() === "strings") { uiContext.get("fruit").label(data.getString("strings")).visible(true); } }
Field Summary Fields
Modifier and Type Field and Description java.lang.Integer background java.lang.Integer selected java.util.List<java.lang.String> values
Fields inherited from class mchorse.mappet.api.ui.components.UIComponent changedProperties, context, DELAY, enabled, h, id, keybinds, marginBottom, marginLeft, marginRight, marginTop, tooltip, tooltipDirection, updateDelay, visible, w, x, y
Constructor Summary