entity.setC3Master(client.getEntity(entityCorrespondance[choC3.getSelectedIndex()]));
Entity chosen = client.getEntity ( entityCorrespondance[choC3.getSelectedIndex()] ); int entC3nodeCount = client.game.getC3SubNetworkMembers( entity ).size(); int choC3nodeCount = client.game.getC3NetworkMembers( chosen ).size(); if ( entC3nodeCount + choC3nodeCount <= Entity.MAX_C3_NODES ) { entity.setC3Master( chosen ); } else { StringBuffer message = new StringBuffer(); message.append( entity.getShortName() ) .append( " can't join the C3 network of\n" ) .append( chosen.getShortName() ) .append( " because that would add " ) .append( entC3nodeCount ) .append( "\nunits to a network that already has " ) .append( choC3nodeCount ) .append( ",\nwhich is more than the maximum of " ) .append( Entity.MAX_C3_NODES ) .append( "." ); client.doAlertDialog( "C3 Network Too Big", message.toString() ); refreshC3(); }
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {        if (actionEvent.getSource() != butCancel) {            // get values            String name = fldName.getText();            int gunnery;            int piloting;            try {                gunnery = Integer.parseInt(fldGunnery.getText());                piloting =  Integer.parseInt(fldPiloting.getText());            } catch (NumberFormatException e) {                new AlertDialog(client.frame, "Number Format Error", "Please enter valid numbers for the skill values.").show();                return;            }                        // keep these reasonable, please            if (gunnery < 0 || gunnery > 7 || piloting < 0 || piloting > 7) {                new AlertDialog(client.frame, "Number Format Error", "Please enter values between 0 and 7 for the skill values.").show();                return;            }                        // change entity            entity.setCrew(new Pilot(name, gunnery, piloting));            if(entity.hasC3() && choC3.getSelectedIndex() > -1) {                entity.setC3Master(client.getEntity(entityCorrespondance[choC3.getSelectedIndex()]));            }            else if(entity.hasC3i() && choC3.getSelectedIndex() > -1) {                entity.setC3NetId(client.getEntity(entityCorrespondance[choC3.getSelectedIndex()]));            }                        entity.setDeployRound(choDeployment.getSelectedIndex());                        // update munitions selections            for (Enumeration e = m_vMunitions.elements(); e.hasMoreElements(); ) {                ((MunitionChoicePanel)e.nextElement()).applyChoice();            }                        setOptions();                        okay = true;        }                this.setVisible(false);    }