Class UnitDisplayPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, LocationSelectListener

public class UnitDisplayPanel extends JPanel implements LocationSelectListener
Displays the info for a mek. This is also a sort of interface for special movement and firing actions.
See Also:
  • Field Details

  • Constructor Details

    • UnitDisplayPanel

      public UnitDisplayPanel()
      Creates and lays out a new mek display.
    • UnitDisplayPanel

      public UnitDisplayPanel(@Nullable ClientGUI clientGui)
      Creates and lays out a new mek display.
      Parameters:
      clientGui - The ClientGUI for the GUI that is creating this UnitDisplay.
    • UnitDisplayPanel

      public UnitDisplayPanel(@Nullable ClientGUI clientGui, @Nullable MegaMekController controller)
      Creates and lays out a new mek display.
      Parameters:
      clientGui - The ClientGUI for the GUI that is creating this UnitDisplay.
      controller - The MegaMekController for the GUI that is creating this UnitDisplay.
  • Method Details

    • setDisplayNonTabbed

      public void setDisplayNonTabbed()
      switch display to the non tabbed version
    • saveSplitterLoc

      public void saveSplitterLoc()
      Save splitter locations to preferences
    • setTitleVisible

      public void setTitleVisible(boolean b)
    • processKeyBinding

      protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
      Overrides:
      processKeyBinding in class JComponent
    • displayEntity

      public void displayEntity(Entity en)
      Displays the specified entity in the panel.
    • updateDisplay

      protected void updateDisplay()
    • getCurrentEntity

      public Entity getCurrentEntity()
      Returns the entity we're currently displaying
    • showPanel

      public void showPanel(String s)
      Changes to the specified panel.
    • locationSelected

      public void locationSelected(int location)
      Shows the location the user picked in the armor diagram, which for the unit display means switching to the Systems tab and selecting that location there.
      Specified by:
      locationSelected in interface LocationSelectListener
      Parameters:
      location - the location that was selected
    • showSpecificSystem

      public void showSpecificSystem(int loc)
      Used to force the display to the Systems tab, on a specific location
      Parameters:
      loc - the location to show
    • addMekDisplayListener

      public void addMekDisplayListener(MekDisplayListener listener)
      Adds the specified mek display listener to receive events from this view.
      Parameters:
      listener - the listener.
    • getClientGUI

      @Nullable public ClientGUI getClientGUI()
      Returns the UnitDisplay's ClientGUI reference, which can be null.
      Returns:
      the ClientGUI reference, or null if not applicable.