21 package com.realtime.crossfire.jxclient.gui.commands;
30 import java.awt.Component;
31 import org.jetbrains.annotations.NotNull;
79 final GUIText loginField = gui.getFirstElement(
GUIText.class,
"account_login");
80 final GUIText passwordField = gui.getFirstElement(
GUIText.class,
"account_password");
81 final GUIText confirmField = gui.getFirstElement(
GUIText.class,
"account_password_confirm");
83 if (loginField == null || passwordField == null || confirmField == null) {
87 final String login = loginField.
getText();
88 final String password = passwordField.
getText();
89 final String confirm = confirmField.
getText();
91 if (login.isEmpty()) {
94 error.
setText(
"Can't have an empty login!");
100 if (password.isEmpty()) {
103 error.
setText(
"Can't have an empty password!");
109 if (confirm.isEmpty()) {
113 if (!confirm.equals(password)) {
116 error.
setText(
"Passwords don't match!");
Abstract base class for all label classes.
static Gui getGui(@NotNull final Component element)
Returns the Gui an element is part of.
void setText(@NotNull final String text)
The label text.
Combines a list of GUIElements to for a gui.
void execute()
Executes the command.Does nothing if called while canExecute() returnsfalse .
AccountCreateCommand(@NotNull final CommandCallback commandCallback, @NotNull final Component button)
Creates a new instance.
void setActive(final boolean active)
Sets the active state of a GUI element.
String getText()
Returns the entered text.
final CommandCallback commandCallback
The CommandCallback to use.
A GUIHTMLLabel that displays the last received "failure" message.
Utility class for Gui related functions.
Interface that defines callback functions needed by commands.
boolean canExecute()
Returns whether this command may be executed.whether this command may be executed ...
final Component element
The Component to find information for account creation.
void setText(@NotNull final String text)
Sets the entered text.
A GUICommand sending an account creation request.
void accountCreate(@NotNull String login, @NotNull String password)
Creates an account.
Abstract base class for text input fields.