Class DamageAnalysisPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
megamek.client.ui.dialogs.unitSelectorDialogs.DamageAnalysisPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class DamageAnalysisPanel extends JPanel
A panel that renders a unit's damage analysis from its DamageProfile as three charts: a Damage vs Range curve chart (maximum, expected, and heat-sustained damage), a Damage per Direction radar, and a Weapon Reach radar.

Shared by the unit viewers of MegaMek and MegaMekLab: it is a tab in EntityViewPane (both unit selectors), and MegaMekLab's editor preview can mount the same panel for live refresh while editing. Call setEntity(Entity) to update; null clears the display.

Curve colors are fixed hues readable on both light and dark themes; the axes and text use the current look-and-feel colors.

See Also:
  • Constructor Details

    • DamageAnalysisPanel

      public DamageAnalysisPanel()
  • Method Details

    • getToolTipText

      public String getToolTipText(MouseEvent event)
      Overrides:
      getToolTipText in class JComponent
    • setEntity

      public void setEntity(@Nullable Entity entity)
      Updates the displayed unit. The damage profile is computed once here, not per repaint.
      Parameters:
      entity - the unit to analyze, or null to clear the display
    • setGunnery

      public void setGunnery(int gunnery)
      Sets the gunnery skill for the expected and sustained curves, overriding the crew's, so the chart can follow a live control (e.g. the unit selector's BV gunnery field). The current unit's chart recomputes immediately.
      Parameters:
      gunnery - the gunnery skill to display the curves at
    • paintComponent

      protected void paintComponent(Graphics graphics)
      Overrides:
      paintComponent in class JComponent