Search in sources :

Example 1 with CrackedAccount

use of mathax.client.systems.accounts.types.CrackedAccount in project Client by MatHax.

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(mathax.client.gui.widgets.containers.WTable) WTextBox(mathax.client.gui.widgets.input.WTextBox) CrackedAccount(mathax.client.systems.accounts.types.CrackedAccount)

Aggregations

WTable (mathax.client.gui.widgets.containers.WTable)1 WTextBox (mathax.client.gui.widgets.input.WTextBox)1 CrackedAccount (mathax.client.systems.accounts.types.CrackedAccount)1