Class UnitDisplayDialog

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class UnitDisplayDialog extends JDialog
A dialog for displaying detailed unit information in MegaMek.

This dialog serves as a container for the UnitDisplay component, which provides detailed information about game entities (meks, vehicles, infantry, etc.). The dialog can operate in two modes:

  • As a persistent, reusable dialog that is hidden when closed
  • As a disposable dialog that is destroyed when closed

The dialog manages its position and size through GUIPreferences, storing separate settings for tabbed and non-tabbed display modes.

See Also:
  • Constructor Details

    • UnitDisplayDialog

      public UnitDisplayDialog(JFrame frame, ClientGUI clientGUI)
      Creates a new UnitDisplayDialog.
      Parameters:
      frame - the parent frame for this dialog
      clientGUI - the ClientGUI reference, which can be null for standalone usage
  • Method Details

    • showEntity

      public static void showEntity(JFrame frame, Entity entity, boolean newInstance)
      Shows an entity in a UnitDisplayDialog, either reusing the existing dialog instance or creating a new one.
      Parameters:
      frame - the parent frame for the dialog
      entity - the entity to display
      newInstance - if true, creates a new dialog that will be disposed on close; if false, reuses or creates a persistent dialog instance
    • saveSettings

      public void saveSettings()
      Saves the current size and position of the dialog to preferences. Different settings are stored based on whether the display is in tabbed or non-tabbed mode.
    • processWindowEvent

      protected void processWindowEvent(WindowEvent e)
      Overrides the default window event processing to save settings when the window is deactivated or closing.
      Overrides:
      processWindowEvent in class JDialog
      Parameters:
      e - the window event
    • processKeyEvent

      protected void processKeyEvent(KeyEvent evt)
      Processes key events and forwards them to the client GUI to enable hotkey functionality throughout the application.
      Overrides:
      processKeyEvent in class Component
      Parameters:
      evt - the key event to process