@Override
    public void init(){
        errorMsg ="";
        name = new TextBox("Enter Username", 300, 360);
        name.setFocus(true);
        name.setMaxChars(12);
        name.addKeyListener(new KeyListener(){
            public void KeyTyped(int keyCode, char keyChar) {
                if(keyCode == Keys.VK_ENTER){
                    name.setText(name.getText());
                    btnConnect.doClick();
                    btnExit.setEnabled(true);
                }
            }        
        });        
        name.addMouseListener(new ButtonListener(){
            @Override
            public void buttonClicked() {
                if(txtNameFirst){
                    name.setText("");
                    txtNameFirst = false;}
                
            }        
        });
        
        addComponent(name);
        
        btnExit = new GameButton("X",GamePanel.WIDTH-60,10);
        addComponent(btnExit);
        btnExit.addButtonListener(new ButtonListener(){          
            public void buttonClicked() {
               setState(GameStateManager.INTRO_STATE);
            }                
        });
        
        btnConnect = new GameButton("Connect",300,420);
        addComponent(btnConnect);
        btnConnect.addButtonListener(new ButtonListener(){          
            public void buttonClicked() {
                btnExit.setEnabled(false);                
                String userName = name.getText().trim();
                char [] invalids = new char[]{'/','\\','-','(',')','~',' '};
                errorMsg = "";
                for(int i =0; i <invalids.length;i ++){
                    if(userName.contains(Character.toString(invalids[i]))){
                        errorMsg = "Invalid UserName, can't contain: " + Arrays.toString(invalids);
                        return;
                    }                    
                }    
                if(userName.contains("Enter Username") || userName.length()==0){
                    errorMsg = "Enter a valid user name";
                    return;
                }
                
                MultiPlayerChat.userName = userName;
                setState(GameStateManager.MULTIPLAYER_CHAT_STATE);    
//                removeComponent(btnConnect);   
//                status = new TextBox("Connecting...",300,420);
//                addComponent(status);
            }                
        }); 
    }