client.addGameListener(new BotGUI(this, (BotClient)client));
    public void connectBot() {        ConnectDialog cd;        cd = new ConnectDialog(frame);        cd.show();        // verify dialog data        if (cd.name == null || cd.serverAddr == null || cd.port == 0) {            return;        }        // Players should have to enter a non-blank, non-whitespace name.        boolean foundValid = false;        char[] nameChars = cd.name.toCharArray();        for (int loop = 0; !foundValid && loop < nameChars.length; loop++) {            if (!Character.isWhitespace(nameChars[loop])) {                foundValid = true;            }        }        if (!foundValid) {            new AlertDialog(frame, "Connect to Game", "Error: enter a player name.").show();            return;        }        // initialize game        client = new TestBot(cd.name, cd.serverAddr, cd.port);        try {            client.connect();        } catch (Exception e) {            StringBuffer error = new StringBuffer();            error.append("Error: could not connect to server at ").append(cd.serverAddr).append(":").append(                cd.port).append(                ".");            new AlertDialog(frame, "Host a Game", error.toString()).show();            frame.setVisible(false);            client.die();        }        client.retrieveServerInfo();    }