Enumeration equip = ce.getMisc(); while ( equip.hasMoreElements() ) { Mounted mounted = (Mounted) equip.nextElement();
for (Mounted mounted : ce.getMisc()) {
    public synchronized void actionPerformed(ActionEvent ev) {        final Entity ce = ce();                        // Are we ignoring events?        if ( this.isIgnoringEvents() ) {            return;        }        if ( statusBarActionPerformed(ev, client) )            return;                  if (!client.isMyTurn()) {            // odd...            return;        }        if (ev.getSource() == butDone) {            moveTo(cmd);        } else if (ev.getActionCommand().equals(MOVE_NEXT)) {            selectEntity(client.getNextEntityNum(cen));        } else if (ev.getActionCommand().equals(MOVE_CANCEL)) {                     clearAllMoves();        } else if (ev.getSource() == butMore) {            buttonLayout++;            buttonLayout %= NUM_BUTTON_LAYOUTS;            setupButtonPanel();        } else if (ev.getActionCommand().equals(MOVE_UNJAM)) {            if (gear == MovementDisplay.GEAR_JUMP || gear == MovementDisplay.GEAR_CHARGE || gear == MovementDisplay.GEAR_DFA || cmd.getMpUsed() > ce.getWalkMP() || gear == MovementDisplay.GEAR_SWIM) { // in the wrong gear                //clearAllMoves();                //gear = Compute.GEAR_LAND;                setUnjamEnabled(false);            }            else {              cmd.addStep(MovePath.STEP_UNJAM_RAC);              moveTo(cmd);            }        } else if (ev.getActionCommand().equals(MOVE_SEARCHLIGHT)) {            cmd.addStep(MovePath.STEP_SEARCHLIGHT);        } else if (ev.getActionCommand().equals(MOVE_WALK)) {            if (gear == MovementDisplay.GEAR_JUMP || gear == MovementDisplay.GEAR_SWIM) {                clearAllMoves();            }            gear = MovementDisplay.GEAR_LAND;        } else if (ev.getActionCommand().equals(MOVE_JUMP)) {            if (gear != MovementDisplay.GEAR_JUMP) {                clearAllMoves();            }            if (!cmd.isJumping()) {                cmd.addStep(MovePath.STEP_START_JUMP);            }            gear = MovementDisplay.GEAR_JUMP;        } else if (ev.getActionCommand().equals(MOVE_SWIM)) {            if (gear != MovementDisplay.GEAR_SWIM) {                clearAllMoves();            }            //dcmd.addStep(MovePath.STEP_SWIM);            gear = MovementDisplay.GEAR_SWIM;            ce.setMovementMode((ce instanceof BipedMech)?IEntityMovementMode.BIPED_SWIM:IEntityMovementMode.QUAD_SWIM);        } else if (ev.getActionCommand().equals(MOVE_TURN)) {            gear = MovementDisplay.GEAR_TURN;        } else if (ev.getActionCommand().equals(MOVE_BACK_UP)) {            if (gear == MovementDisplay.GEAR_JUMP) {                clearAllMoves();            }            gear = MovementDisplay.GEAR_BACKUP;        } else if (ev.getActionCommand().equals(MOVE_CLEAR)) {                      clearAllMoves();            if (!client.game.containsMinefield(ce.getPosition())) {                clientgui.doAlertDialog( Messages.getString("MovementDisplay.CantClearMinefield"), //$NON-NLS-1$                                      Messages.getString("MovementDisplay.NoMinefield") ); //$NON-NLS-1$                return;            }            // Does the entity has a minesweeper?            int clear = Minefield.CLEAR_NUMBER_INFANTRY;            int boom = Minefield.CLEAR_NUMBER_INFANTRY_ACCIDENT;            Enumeration equip = ce.getMisc();            while ( equip.hasMoreElements() ) {                Mounted mounted = (Mounted) equip.nextElement();                if ( mounted.getType().hasFlag(MiscType.F_TOOLS)                     && mounted.getType().hasSubType(MiscType.S_MINESWEEPER) ) {                    int sweeperType = mounted.getType().getToHitModifier();                    clear = Minefield.CLEAR_NUMBER_SWEEPER[sweeperType];                    boom = Minefield.CLEAR_NUMBER_SWEEPER_ACCIDENT[sweeperType];                    break;                }            }            if (clientgui.doYesNoDialog( Messages.getString("MovementDisplay.ClearMinefieldDialog.title"), //$NON-NLS-1$                    Messages.getString("MovementDisplay.ClearMinefieldDialog.message", new Object[]{ //$NON-NLS-1$                            new Integer(clear), new Integer(boom)})            )) {                cmd.addStep(MovePath.STEP_CLEAR_MINEFIELD);                moveTo(cmd);            }        } else if (ev.getActionCommand().equals(MOVE_CHARGE)) {            if (gear != MovementDisplay.GEAR_LAND) {                clearAllMoves();            }            gear = MovementDisplay.GEAR_CHARGE;        } else if (ev.getActionCommand().equals(MOVE_DFA)) {            if (gear != MovementDisplay.GEAR_JUMP) {                clearAllMoves();            }            gear = MovementDisplay.GEAR_DFA;            if (!cmd.isJumping()) {                cmd.addStep(MovePath.STEP_START_JUMP);            }        } else if (ev.getActionCommand().equals(MOVE_GET_UP)) {            clearAllMoves();            if (cmd.getFinalProne() || cmd.getFinalHullDown()) {                cmd.addStep(MovePath.STEP_GET_UP);            }            clientgui.bv.drawMovementData(ce, cmd);            clientgui.bv.repaint();            butDone.setLabel(Messages.getString("MovementDisplay.Move")); //$NON-NLS-1$        } else if (ev.getActionCommand().equals(MOVE_GO_PRONE)) {            gear = MovementDisplay.GEAR_LAND;            if (!cmd.getFinalProne()) {                cmd.addStep(MovePath.STEP_GO_PRONE);            }            clientgui.bv.drawMovementData(ce, cmd);            clientgui.bv.repaint();            butDone.setLabel(Messages.getString("MovementDisplay.Move")); //$NON-NLS-1$        } else if (ev.getActionCommand().equals(MOVE_HULL_DOWN)) {            gear = MovementDisplay.GEAR_LAND;            if (!cmd.getFinalHullDown()) {                cmd.addStep(MovePath.STEP_HULL_DOWN);            }            clientgui.bv.drawMovementData(ce, cmd);            clientgui.bv.repaint();            butDone.setLabel(Messages.getString("MovementDisplay.Move")); //$NON-NLS-1$        } else if (ev.getActionCommand().equals(MOVE_FLEE) && clientgui.doYesNoDialog(Messages.getString("MovementDisplay.EscapeDialog.title"), Messages.getString("MovementDisplay.EscapeDialog.message"))) { //$NON-NLS-1$ //$NON-NLS-2$            clearAllMoves();            cmd.addStep(MovePath.STEP_FLEE);            moveTo(cmd);        } else if (ev.getActionCommand().equals(MOVE_EJECT)) {            if (ce instanceof Tank) {                if (clientgui.doYesNoDialog(Messages.getString("MovementDisplay.AbandonDialog.title"), Messages.getString("MovementDisplay.AbandonDialog.message"))) { //$NON-NLS-1$ //$NON-NLS-2$                    clearAllMoves();                    cmd.addStep(MovePath.STEP_EJECT);                    moveTo(cmd);                }            } else if (clientgui.doYesNoDialog(Messages.getString("MovementDisplay.AbandonDialog1.title"), Messages.getString("MovementDisplay.AbandonDialog1.message"))) { //$NON-NLS-1$ //$NON-NLS-2$                clearAllMoves();                cmd.addStep(MovePath.STEP_EJECT);                moveTo(cmd);            }        } else if ( ev.getActionCommand().equals(MOVE_LOAD) ) {            // Find the other friendly unit in our hex, add it            // to our local list of loaded units, and then stop.            Entity other = null;            Enumeration entities =                client.game.getEntities( ce.getPosition() );            while ( entities.hasMoreElements() ) {                other = (Entity)entities.nextElement();                if ( ce.getOwner() == other.getOwner() &&                     !ce.equals(other) ) {                    loadedUnits.addElement( other );                    break;                }                other = null;            }            if ( other != null ) {                cmd.addStep( MovePath.STEP_LOAD );                clientgui.bv.drawMovementData(ce, cmd);                clientgui.bv.repaint();                gear = MovementDisplay.GEAR_LAND;            } //else - didn't find a unit to load        } else if ( ev.getActionCommand().equals(MOVE_UNLOAD) ) {            // Ask the user if we're carrying multiple units.            Entity other = getUnloadedUnit();            if ( other != null ) {                cmd.addStep( MovePath.STEP_UNLOAD, other );                clientgui.bv.drawMovementData(ce, cmd);                clientgui.bv.repaint();            } //else - Player canceled the unload.        } else if (ev.getActionCommand().equals(MOVE_RAISE_ELEVATION) ) {            cmd.addStep(MovePath.STEP_UP);            clientgui.bv.drawMovementData(ce, cmd);            clientgui.bv.repaint();        } else if (ev.getActionCommand().equals(MOVE_LOWER_ELEVATION) ) {            cmd.addStep(MovePath.STEP_DOWN);            clientgui.bv.drawMovementData(ce, cmd);            clientgui.bv.repaint();        } else if (ev.getActionCommand().equals(MOVE_CLIMB_MODE) ) {            MoveStep ms = cmd.getLastStep();            if(ms != null && (ms.getType() == MovePath.STEP_CLIMB_MODE_ON || ms.getType() == MovePath.STEP_CLIMB_MODE_OFF))                cmd.removeLastStep();            else if(cmd.getFinalClimbMode())                cmd.addStep(MovePath.STEP_CLIMB_MODE_OFF);            else                cmd.addStep(MovePath.STEP_CLIMB_MODE_ON);            clientgui.bv.drawMovementData(ce, cmd);            clientgui.bv.repaint();        } else if (ev.getActionCommand().equals(MOVE_LAY_MINE)) {            clearAllMoves();            int i = chooseMineToLay();            if (i != -1) {                Mounted m = ce().getEquipment(i);                if (m.getMineType() == Mounted.MINE_VIBRABOMB) {                    VibrabombSettingDialog vsd  = new VibrabombSettingDialog(clientgui.frame);                    vsd.show();                    m.setVibraSetting(vsd.getSetting());                }                cmd.addStep(MovePath.STEP_LAY_MINE, i);                moveTo(cmd);            }        }        updateProneButtons();        updateRACButton();        updateSearchlightButton();        updateLoadButtons();        updateElevationButtons();    }