Class LicensingDialog

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

public class LicensingDialog extends AbstractButtonDialog
Displays licensing, legal, and welcome information about the MegaMek Suite on application startup. The user must click Acknowledge to proceed.

Includes a "don't show again" checkbox that takes effect when the user acknowledges. Closing the dialog via the X button or Escape key exits the application.

Subclasses in MegaMekLab and MekHQ can override buildHtmlContent() to customize the displayed text.

See Also:
  • Constructor Details

    • LicensingDialog

      public LicensingDialog(JFrame frame)
      Creates a new licensing dialog with the default MegaMek title.
      Parameters:
      frame - the parent frame
    • LicensingDialog

      protected LicensingDialog(JFrame frame, String customTitle)
      Creates a new licensing dialog with a custom title. Used by MegaMekLab and MekHQ to show their own product name and version.
      Parameters:
      frame - the parent frame
      customTitle - the full title string (e.g. "Welcome to MekHQ 0.50.13")
  • Method Details

    • windowClosing

      public void windowClosing(WindowEvent evt)
      Description copied from class: AbstractDialog
      Note: Closing the dialog should always allow one to close the dialog.
      Specified by:
      windowClosing in interface WindowListener
      Overrides:
      windowClosing in class AbstractDialog
    • createCenterPane

      protected Container createCenterPane()
      Description copied from class: AbstractDialog
      This is used to create the dialog's center pane
      Specified by:
      createCenterPane in class AbstractDialog
      Returns:
      the center pane of the dialog
    • buildHtmlContent

      protected String buildHtmlContent()
      Builds the HTML content for the licensing dialog. Subclasses can override this method to customize the displayed text.
      Returns:
      the HTML string to display
    • buildLegalHtml

      public static String buildLegalHtml()
      Builds the shared legal/licensing HTML block used by both the licensing dialog and About dialogs across the suite.
      Returns:
      the legal HTML content (without outer html/body tags)
    • createButtonPanel

      protected JPanel createButtonPanel()
      Overrides:
      createButtonPanel in class AbstractButtonDialog
      Returns:
      the created Button Panel
    • okAction

      protected void okAction()
      Description copied from class: AbstractButtonDialog
      Action performed when the Ok button is clicked.
      Overrides:
      okAction in class AbstractButtonDialog
    • cancelAction

      protected void cancelAction()
      Description copied from class: AbstractDialog
      Action performed when the Cancel button is clicked, the dialog is closed by the X button, or the escape key is pressed
      Overrides:
      cancelAction in class AbstractDialog
    • showIfNeeded

      public static void showIfNeeded(JFrame frame)
      Shows the licensing dialog if the user has not opted out.
      Parameters:
      frame - the parent frame
    • showIfNeeded

      public static void showIfNeeded(JFrame frame, String customTitle)
      Shows the licensing dialog with a custom title if the user has not opted out. Used by MegaMekLab and MekHQ to display their own product name.
      Parameters:
      frame - the parent frame, or null if no frame exists yet
      customTitle - the full title string (e.g. "Welcome to MekHQ 0.50.13")