Search in sources :

Example 1 with WTextBox

use of meteordevelopment.meteorclient.gui.widgets.input.WTextBox in project meteor-rejects by AntiCope.

the class ChatBot method fillTable.

private void fillTable(GuiTheme theme, WTable table) {
    table.clear();
    commands.keySet().forEach((key) -> {
        table.add(theme.label(key)).expandCellX();
        table.add(theme.label(commands.get(key))).expandCellX();
        WMinus delete = table.add(theme.minus()).widget();
        delete.action = () -> {
            commands.remove(key);
            fillTable(theme, table);
        };
        table.row();
    });
    WTextBox textBoxK = table.add(theme.textBox(currMsgK)).minWidth(100).expandX().widget();
    textBoxK.action = () -> {
        currMsgK = textBoxK.get();
    };
    WTextBox textBoxV = table.add(theme.textBox(currMsgV)).minWidth(100).expandX().widget();
    textBoxV.action = () -> {
        currMsgV = textBoxV.get();
    };
    WPlus add = table.add(theme.plus()).widget();
    add.action = () -> {
        if (currMsgK != "" && currMsgV != "") {
            commands.put(currMsgK, currMsgV);
            currMsgK = "";
            currMsgV = "";
            fillTable(theme, table);
        }
    };
    table.row();
}
Also used : WTextBox(meteordevelopment.meteorclient.gui.widgets.input.WTextBox) WMinus(meteordevelopment.meteorclient.gui.widgets.pressable.WMinus) WPlus(meteordevelopment.meteorclient.gui.widgets.pressable.WPlus)

Example 2 with WTextBox

use of meteordevelopment.meteorclient.gui.widgets.input.WTextBox in project meteor-client by MeteorDevelopment.

the class ModulesScreen method createSearch.

protected WWindow createSearch(WContainer c) {
    WWindow w = theme.window("Search");
    w.id = "search";
    if (theme.categoryIcons()) {
        w.beforeHeaderInit = wContainer -> wContainer.add(theme.item(Items.COMPASS.getDefaultStack())).pad(2);
    }
    c.add(w);
    w.view.scrollOnlyWhenMouseOver = true;
    w.view.hasScrollBar = false;
    w.view.maxHeight -= 20;
    WVerticalList l = theme.verticalList();
    WTextBox text = w.add(theme.textBox("")).minWidth(140).expandX().widget();
    text.setFocused(true);
    text.action = () -> {
        l.clear();
        createSearchW(l, text.get());
    };
    w.add(l).expandX();
    createSearchW(l, text.get());
    return w;
}
Also used : WWindow(meteordevelopment.meteorclient.gui.widgets.containers.WWindow) WTextBox(meteordevelopment.meteorclient.gui.widgets.input.WTextBox) WVerticalList(meteordevelopment.meteorclient.gui.widgets.containers.WVerticalList)

Example 3 with WTextBox

use of meteordevelopment.meteorclient.gui.widgets.input.WTextBox in project meteor-client by MeteorDevelopment.

the class StringListSetting method fillTable.

public static void fillTable(GuiTheme theme, WTable table, StringListSetting setting) {
    setting.get().removeIf(String::isEmpty);
    ArrayList<String> strings = new ArrayList<>(setting.get());
    for (int i = 0; i < setting.get().size(); i++) {
        int msgI = i;
        String message = setting.get().get(i);
        WTextBox textBox = table.add(theme.textBox(message)).expandX().widget();
        textBox.action = () -> strings.set(msgI, textBox.get());
        textBox.actionOnUnfocused = () -> setting.set(strings);
        WMinus delete = table.add(theme.minus()).widget();
        delete.action = () -> {
            strings.remove(msgI);
            setting.set(strings);
            table.clear();
            fillTable(theme, table, setting);
        };
        table.row();
    }
    WTextBox textBox = table.add(theme.textBox(setting.newText)).minWidth(300).expandX().widget();
    textBox.action = () -> setting.newText = textBox.get();
    WPlus add = table.add(theme.plus()).widget();
    add.action = () -> {
        strings.add(setting.newText);
        setting.set(strings);
        setting.newText = "";
        table.clear();
        fillTable(theme, table, setting);
    };
    // Reset
    table.row();
    WButton reset = table.add(theme.button("Reset")).widget();
    reset.action = () -> {
        setting.reset();
        table.clear();
        fillTable(theme, table, setting);
    };
}
Also used : ArrayList(java.util.ArrayList) NbtString(net.minecraft.nbt.NbtString) WTextBox(meteordevelopment.meteorclient.gui.widgets.input.WTextBox) WButton(meteordevelopment.meteorclient.gui.widgets.pressable.WButton) WMinus(meteordevelopment.meteorclient.gui.widgets.pressable.WMinus) WPlus(meteordevelopment.meteorclient.gui.widgets.pressable.WPlus)

Example 4 with WTextBox

use of meteordevelopment.meteorclient.gui.widgets.input.WTextBox in project meteor-client by MeteorDevelopment.

the class AddAlteningAccountScreen method initWidgets.

@Override
public void initWidgets() {
    WTable t = add(theme.table()).widget();
    // Token
    t.add(theme.label("Token: "));
    WTextBox token = t.add(theme.textBox("")).minWidth(400).expandX().widget();
    token.setFocused(true);
    t.row();
    // Add
    add = t.add(theme.button("Add")).expandX().widget();
    add.action = () -> {
        if (!token.get().isEmpty()) {
            AccountsScreen.addAccount(this, parent, new TheAlteningAccount(token.get()));
        }
    };
    enterAction = add.action;
}
Also used : WTable(meteordevelopment.meteorclient.gui.widgets.containers.WTable) TheAlteningAccount(meteordevelopment.meteorclient.systems.accounts.types.TheAlteningAccount) WTextBox(meteordevelopment.meteorclient.gui.widgets.input.WTextBox)

Example 5 with WTextBox

use of meteordevelopment.meteorclient.gui.widgets.input.WTextBox in project meteor-client by MeteorDevelopment.

the class AddCrackedAccountScreen method initWidgets.

@Override
public void initWidgets() {
    WTable t = add(theme.table()).widget();
    // Name
    t.add(theme.label("Name: "));
    WTextBox name = t.add(theme.textBox("", (text, c) -> c != ' ')).minWidth(400).expandX().widget();
    name.setFocused(true);
    t.row();
    // Add
    add = t.add(theme.button("Add")).expandX().widget();
    add.action = () -> {
        if (!name.get().isEmpty() && (name.get().length() < 17) && name.get().matches("^[a-zA-Z0-9_]+$")) {
            CrackedAccount account = new CrackedAccount(name.get());
            if (!(Accounts.get().exists(account))) {
                AccountsScreen.addAccount(this, parent, account);
            }
        }
    };
    enterAction = add.action;
}
Also used : WTable(meteordevelopment.meteorclient.gui.widgets.containers.WTable) WTextBox(meteordevelopment.meteorclient.gui.widgets.input.WTextBox) CrackedAccount(meteordevelopment.meteorclient.systems.accounts.types.CrackedAccount)

Aggregations

WTextBox (meteordevelopment.meteorclient.gui.widgets.input.WTextBox)7 WTable (meteordevelopment.meteorclient.gui.widgets.containers.WTable)3 ArrayList (java.util.ArrayList)2 WMinus (meteordevelopment.meteorclient.gui.widgets.pressable.WMinus)2 WPlus (meteordevelopment.meteorclient.gui.widgets.pressable.WPlus)2 WVerticalList (meteordevelopment.meteorclient.gui.widgets.containers.WVerticalList)1 WWindow (meteordevelopment.meteorclient.gui.widgets.containers.WWindow)1 WButton (meteordevelopment.meteorclient.gui.widgets.pressable.WButton)1 CrackedAccount (meteordevelopment.meteorclient.systems.accounts.types.CrackedAccount)1 TheAlteningAccount (meteordevelopment.meteorclient.systems.accounts.types.TheAlteningAccount)1 BookScreen (net.minecraft.client.gui.screen.ingame.BookScreen)1 NbtString (net.minecraft.nbt.NbtString)1 BookUpdateC2SPacket (net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket)1