wLongR.setText((mediumR + 1) + " - " + longR);
wLongR.setText(mediumR + 1 + " - " + longR);
        private void displaySelected() {            // short circuit if not selected            if (weaponList.getSelectedIndex() == -1) {                m_chAmmo.removeAll();                m_chAmmo.setEnabled(false);                wNameR.setText(""); //$NON-NLS-1$                wHeatR.setText("--"); //$NON-NLS-1$                wDamR.setText("--"); //$NON-NLS-1$                wMinR.setText("---"); //$NON-NLS-1$                wShortR.setText("---"); //$NON-NLS-1$                wMedR.setText("---"); //$NON-NLS-1$                wLongR.setText("---"); //$NON-NLS-1$                wExtR.setText("---"); //$NON-NLS-1$                return;            }            Mounted mounted = entity.getWeaponList().get(weaponList.getSelectedIndex());            WeaponType wtype = (WeaponType) mounted.getType();            // update weapon display            wNameR.setText(mounted.getDesc());            wHeatR.setText(wtype.getHeat() + ""); //$NON-NLS-1$            if (wtype.getDamage() == WeaponType.DAMAGE_MISSILE) {                wDamR.setText(Messages.getString("MechDisplay.Missile")); //$NON-NLS-1$            } else if (wtype.getDamage() == WeaponType.DAMAGE_VARIABLE) {                wDamR.setText(Messages.getString("MechDisplay.Variable")); //$NON-NLS-1$            } else if (wtype.getDamage() == WeaponType.DAMAGE_SPECIAL) {                wDamR.setText(Messages.getString("MechDisplay.Special")); //$NON-NLS-1$            } else if (wtype.getDamage() == WeaponType.DAMAGE_ARTILLERY) {                StringBuffer damage = new StringBuffer();                damage.append(Integer.toString(wtype.getRackSize()))                        .append('/')                        .append(Integer.toString(wtype.getRackSize() / 2));                wDamR.setText(damage.toString());            } else {                wDamR.setText(Integer.toString(wtype.getDamage()));            }            // update range            int shortR = wtype.getShortRange();            int mediumR = wtype.getMediumRange();            int longR = wtype.getLongRange();            int extremeR = wtype.getExtremeRange();            if (entity.getLocationStatus(mounted.getLocation()) == ILocationExposureStatus.WET                    || longR == 0) {                shortR = wtype.getWShortRange();                mediumR = wtype.getWMediumRange();                longR = wtype.getWLongRange();                extremeR = wtype.getWExtremeRange();            }            if (wtype.getMinimumRange() > 0) {                wMinR.setText(Integer.toString(wtype.getMinimumRange()));            } else {                wMinR.setText("---"); //$NON-NLS-1$            }            if (shortR > 1) {                wShortR.setText("1 - " + shortR); //$NON-NLS-1$            } else {                wShortR.setText("" + shortR); //$NON-NLS-1$            }            if (mediumR - shortR > 1) {                wMedR.setText((shortR + 1) + " - " + mediumR); //$NON-NLS-1$            } else {                wMedR.setText("" + mediumR); //$NON-NLS-1$            }            if (longR - mediumR > 1) {                wLongR.setText((mediumR + 1) + " - " + longR); //$NON-NLS-1$            } else {                wLongR.setText("" + longR); //$NON-NLS-1$            }            if (extremeR - longR > 1) {                wExtR.setText((longR + 1) + " - " + extremeR); //$NON-NLS-1$            } else {                wExtR.setText("" + extremeR); //$NON-NLS-1$            }            // Update the range display to account for the weapon's loaded ammo.            if (mounted.getLinked() != null) {                AmmoType atype = (AmmoType) mounted.getLinked().getType();                updateRangeDisplayForAmmo(atype);            }            // update ammo selector            boolean bOwner = (clientgui.getClient().getLocalPlayer().equals(entity.getOwner()));            m_chAmmo.removeAll();            if (wtype.getAmmoType() == AmmoType.T_NA || !bOwner) {                m_chAmmo.setEnabled(false);            } else if (wtype.hasFlag(WeaponType.F_ONESHOT)) {                if (mounted.getLinked().getShotsLeft() == 1) {                    m_chAmmo.addItem(formatAmmo(mounted.getLinked()));                    m_chAmmo.setEnabled(true);                } else {                    m_chAmmo.setEnabled(false);                }            } else {                if (!(entity instanceof Infantry)) {                    m_chAmmo.setEnabled(true);                } else {                    m_chAmmo.setEnabled(false);                }                vAmmo = new ArrayList<Mounted>();                int nCur = -1;                int i = 0;                for (Mounted mountedAmmo : entity.getAmmo()) {                    AmmoType atype = (AmmoType) mountedAmmo.getType();                    if (mountedAmmo.isAmmoUsable() &&                            atype.getAmmoType() == wtype.getAmmoType() &&                            atype.getRackSize() == wtype.getRackSize()) {                        vAmmo.add(mountedAmmo);                        m_chAmmo.addItem(formatAmmo(mountedAmmo));                        if (mounted.getLinked().equals(mountedAmmo)) {                            nCur = i;                        }                        i++;                    }                }                if (nCur == -1) {                    // outcommenting this fixes bug 1041003 (if a linked ammobin                    // gets breached, it will continue to be used, and other ammo                    // can't be selected for the weapon that the breached ammo was                    // linked to), and did not cause anything to misbehave in my                    // testing, apart from the Choice being enabled even if there                    // is no ammo to choose from, but that is only a minor issue                    // m_chAmmo.setEnabled(false);                } else {                    m_chAmmo.setSelectedIndex(nCur);                }            }            //send event to other parts of the UI which care            processMechDisplayEvent(new MechDisplayEvent(this, entity, mounted));        }