* {@inheritDoc}
*/
public void update(ServerMessage m) {
if (m instanceof RegistrationResponseMessage) {
RegistrationResponseMessage response
= (RegistrationResponseMessage) m;
if (response.getResponseType()
== IConstants.ResponseType.username) {
errorDialog("Username already exists!");
register.setEnabled(true);
lName.requestFocus();
}
if (response.getResponseType() == IConstants.ResponseType.ok) {
UIManager.put("OptionPane.background", Color.BLACK);
UIManager.put("Panel.background", Color.BLACK);
UIManager.put("OptionPane.messageForeground", Color.GREEN);
JOptionPane.showMessageDialog(this, "Registration Successful",
"Thank You", 2);
getCore().popScreen();
// login
LoginRequestMessage loginMessage = new LoginRequestMessage();
loginMessage.setVersion(Core.getVersion());
loginMessage.setUsername(lName.getText());
loginMessage.setPassword(String
.valueOf(lPassword.getPassword()));
loginMessage.setMacaddress(getCore().getNetwork().getMACAddress());
getCore().getNetwork().sendMessage(loginMessage);
}
if (response.getResponseType() == IConstants.ResponseType.failed) {
errorDialog("Unknown error");
register.setEnabled(true);
lName.requestFocus();
}