Class WeaponPanel

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, ListSelectionListener, IPreferenceChangeListener

public class WeaponPanel extends PicMap implements ListSelectionListener, ActionListener, IPreferenceChangeListener
This class contains the all the gizmos for firing the mek's weapons.
See Also:
  • Field Details

    • weaponList

      public JList<String> weaponList
    • m_chBayWeapon

      public JComboBox<String> m_chBayWeapon
    • wTargetExtraInfo

      public JLabel wTargetExtraInfo
    • wRangeR

      public JLabel wRangeR
    • INTERNAL_PANE_WIDTH

      public static final int INTERNAL_PANE_WIDTH
      See Also:
    • LINE_HEIGHT

      public static final int LINE_HEIGHT
      See Also:
    • COLOR_FG

      public static final Color COLOR_FG
    • TEXT_BG

      public static final Color TEXT_BG
  • Method Details

    • clearToHit

      public void clearToHit()
    • setToHit

      public void setToHit(ToHitData toHit)
    • setToHit

      public void setToHit(ToHitData toHit, boolean natAptGunnery)
    • setToHit

      public void setToHit(String message)
    • setTarget

      public void setTarget(@Nullable Targetable target, @Nullable String extraInfo)
    • onResize

      public void onResize()
      Description copied from class: PicMap
      onResize() function is calling every time PicMap is resized. Have to be implemented directly to manage composition of component on resizing.
      Specified by:
      onResize in class PicMap
    • displayMek

      public void displayMek(Entity en)
      updates fields for the specified mek

      fix the ammo when it's added

    • getSelectedEntityId

      public int getSelectedEntityId()
    • selectWeapon

      public void selectWeapon(int wn)
      Selects the weapon with the specified weapon ID.
    • selectWeapon

      public void selectWeapon(WeaponMounted weapon)
    • getSelectedWeapon

      public WeaponMounted getSelectedWeapon()
      Returns:
      the Mounted for the selected weapon in the weapon list.
    • getSelectedAmmo

      public Optional<AmmoMounted> getSelectedAmmo()
      Returns:
      the AmmoMounted currently selected by the ammo selector combo box, if any. The returned AmmoMounted may or may not be the ammo that is linked to the weapon.
    • getSelectedWeaponNum

      public int getSelectedWeaponNum()
      Returns the equipment ID number for the weapon currently selected
    • selectFirstWeapon

      public void selectFirstWeapon()
      Selects the first valid weapon in the weapon list.
    • getNextWeaponListIdx

      public int getNextWeaponListIdx()
    • getPrevWeaponListIdx

      public int getPrevWeaponListIdx()
    • getNextWeaponNum

      public int getNextWeaponNum()
    • getNextWeapon

      public WeaponMounted getNextWeapon()
    • selectNextWeapon

      public int selectNextWeapon()
      Selects the next valid weapon in the weapon list.
      Returns:
      The weaponId for the selected weapon
    • selectPrevWeapon

      public int selectPrevWeapon()
      Selects the previous valid weapon in the weapon list.
      Returns:
      The weaponId for the selected weapon
    • valueChanged

      public void valueChanged(ListSelectionEvent event)
      Specified by:
      valueChanged in interface ListSelectionListener
    • actionPerformed

      public void actionPerformed(ActionEvent ev)
      Specified by:
      actionPerformed in interface ActionListener
    • getPrevTarget

      public Targetable getPrevTarget()
    • setPrevTarget

      public void setPrevTarget(Targetable prevTarget)
    • preferenceChange

      public void preferenceChange(PreferenceChangeEvent e)
      Specified by:
      preferenceChange in interface IPreferenceChangeListener
    • updateForEntity

      public void updateForEntity(Entity entity)
      Updates the Weapon Panel with the information for the given entity. If the given entity is `null`, this method will do nothing.
      Parameters:
      entity - - The weapon panel will update info based on the Entity provided.