entity.setOffBoard(chOffBoard.getState()); entity.setDeployed(chOffBoard.getState()); entity.setOffBoardDistance(offBoardDistance); entity.setOffBoardDirection(choOffBoardDirection.getSelectedIndex()); refreshOffBoard();
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {        if (actionEvent.getSource() != butCancel) {            // get values            String name = fldName.getText();            int gunnery;            int piloting;            int offBoardDistance;            try {                gunnery = Integer.parseInt(fldGunnery.getText());                piloting =  Integer.parseInt(fldPiloting.getText());                offBoardDistance = Integer.parseInt(fldOffBoardDistance.getText());            } catch (NumberFormatException e) {                new AlertDialog(clientgui.frame, "Number Format Error", "Please enter valid numbers for skill values and off-board distance.").show();                return;            }                        // keep these reasonable, please            if (gunnery < 0 || gunnery > 7 || piloting < 0 || piloting > 7) {                new AlertDialog(clientgui.frame, "Number Format Error", "Please enter values between 0 and 7 for the skill values.").show();                return;            }            if (offBoardDistance < 17) {                new AlertDialog(clientgui.frame, "Number Format Error", "Offboard units need to be at least one mapsheet (17 hexes) away.").show();                return;            }            // change entity            entity.setCrew(new Pilot(name, gunnery, piloting));            entity.setOffBoard(chOffBoard.getState());            entity.setDeployed(chOffBoard.getState());            entity.setOffBoardDistance(offBoardDistance);            entity.setOffBoardDirection(choOffBoardDirection.getSelectedIndex());            refreshOffBoard();            if(entity.hasC3() && choC3.getSelectedIndex() > -1) {                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( "." );                    clientgui.doAlertDialog( "C3 Network Too Big",                                          message.toString() );                    refreshC3();                }            }            else if(entity.hasC3i() && choC3.getSelectedIndex() > -1) {                entity.setC3NetId(client.getEntity(entityCorrespondance[choC3.getSelectedIndex()]));            }            // If the player wants to swap unit numbers, update both            // entities and send an update packet for the other entity.            if ( !entityUnitNum.isEmpty() &&                 choUnitNum.getSelectedIndex() > 0 ) {                Entity other =  (Entity) this.entityUnitNum.elementAt                    ( choUnitNum.getSelectedIndex() );                char temp = this.entity.getUnitNumber();                this.entity.setUnitNumber( other.getUnitNumber() );                other.setUnitNumber( temp );                client.sendUpdateEntity( other );            }            // Set the entity's deployment round.            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);    }