private boolean registered()
		{
			JLabel regNameLabel = new JLabel("Login name (4-10 chars):",
					JLabel.RIGHT);
			JTextField regNameField = new JTextField(20);
			JLabel regPasswordLabel = new JLabel("Password (2-10 chars):",
					JLabel.RIGHT);
			JPasswordField regPasswordField = new JPasswordField(20);
			JLabel regPasswordLabel2 = new JLabel("Confirm password:",
					JLabel.RIGHT);
			JPasswordField regPasswordField2 = new JPasswordField(20);

			JPanel fieldsPanel = new JPanel();
			fieldsPanel.setLayout(new GridLayout(3, 2, 10, 10));
			fieldsPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
			fieldsPanel.add(regNameLabel);
			fieldsPanel.add(regNameField);
			fieldsPanel.add(regPasswordLabel);
			fieldsPanel.add(regPasswordField);
			fieldsPanel.add(regPasswordLabel2);
			fieldsPanel.add(regPasswordField2);

			final String optionNames[] = { "Register", "Cancel" };

			if (JOptionPane.showOptionDialog(thisWindow, fieldsPanel,
					"New user registration", JOptionPane.OK_CANCEL_OPTION,
					JOptionPane.PLAIN_MESSAGE, null, optionNames,
					optionNames[0]) != 0)
				return true; // User pressed "Cancel"

			String name = regNameField.getText().trim().toLowerCase();
			String password = (new String(regPasswordField.getPassword()))
					.trim().toLowerCase();
			String password2 = (new String(regPasswordField2.getPassword()))
					.trim().toLowerCase();

			String errorMsg = "";
			int result = password.compareTo(password2);

			if (result != 0)
			{
				errorMsg = "Passwords mismatch, re-enter";
			} else
			{
				result = server.addUser(name, password);
				if (result < 0)
				{
					if (result == -1)
						errorMsg = "Login name must be 4-10 characters long";
					else if (result == -2)
						errorMsg = "Password must be 2-10 characters long";
					else if (result == -3)
						errorMsg = "Login name already taken, choose another one";
					else
						errorMsg = "Unknown error code";
				}
			}

			if (result != 0)
			{
				JOptionPane.showMessageDialog(thisWindow, errorMsg,
						"Registration failed", JOptionPane.ERROR_MESSAGE);
				nameField.setText("");
				passwordField.setText("");
				return false;
			} else
			{
				JOptionPane.showMessageDialog(thisWindow, "Added " + name,
						"Registration successful",
						JOptionPane.INFORMATION_MESSAGE);
				nameField.setText(name);
				passwordField.setText(password);
				return true;
			}
		}