@SuppressWarnings("unchecked")
    private void refreshGameList() {
        
        try {
            sendToServer(Packet.getGameListPacket());                    
            Packet answer = PacketManager.readPacketFromStream(in);
            
            if(answer == null) {
                fatalErrorExit("Server connection error.");                        
            }
            
            if(answer.getCode().equals(Packet.PACKET_CODES.GAMES_LIST_CODE)) {                
                mainPanel.setGameList( (ArrayList<GameLobby>) answer.getData() );
                
            } else if(answer.getCode().equals(Packet.PACKET_CODES.INCORRECT_COMMAND_CODE)) {
                warning("Incorrect command.");
                
            } else if(answer.getCode().equals(Packet.PACKET_CODES.SERVER_ERROR_CODE)) {
                warning("Unknown server error.");
                
            } else if(answer.getCode().equals(Packet.PACKET_CODES.USER_NOT_SINGING_UP_CODE)) {
                warning("User not singing up.");
            }
            
        } catch(IOException e1) {
            fatalErrorExit("Server connection error.");
        }
    }