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; }
    public void connect() {        ConnectDialog cd;        cd = new ConnectDialog(frame);        cd.show();        // verify dialog data        if(cd.name == null || cd.serverAddr == null || cd.port == 0) {            return;        }        // initialize game        client = new Client(cd.name, cd.serverAddr, cd.port);		launch(client.getFrame());    }