Class UnitIconDialog

java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
megamek.client.ui.baseComponents.AbstractDialog
megamek.client.ui.baseComponents.AbstractButtonDialog
megamek.client.ui.dialogs.AbstractIconChooserDialog
All Implemented Interfaces:
WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class UnitIconDialog extends StandardForceIconDialog
UnitIconDialog is an implementation of StandardForceIconDialog that is used to select a UnitIcon from the Force Icon Directory. It defaults to the Force/Units/ category, as that's the primary location for them, and allows the selected icon to be overridden when necessary (such as when we want to specify that a Unit does not have an icon)
See Also:
  • Constructor Details

    • UnitIconDialog

      public UnitIconDialog(JFrame frame, @Nullable megamek.common.icons.AbstractIcon icon)
  • Method Details

    • getChooser

      protected UnitIconChooser getChooser()
      Overrides:
      getChooser in class StandardForceIconDialog
    • getSelectedItem

      @Nullable public UnitIcon getSelectedItem()
      Overrides:
      getSelectedItem in class StandardForceIconDialog
    • getOverride

      @Nullable public UnitIcon getOverride()
      This is used to override the selected UnitIcon, to allow it to be specified outside of the possible selections. The primary use is in setting up a non-existent UnitIcon.
      Returns:
      the current selected item override, which is null when there isn't an override.
    • setOverride

      public void setOverride(@Nullable UnitIcon override)
    • createButtonPanel

      protected JPanel createButtonPanel()
      Overrides:
      createButtonPanel in class megamek.client.ui.dialogs.AbstractIconChooserDialog
    • finalizeInitialization

      protected void finalizeInitialization() throws Exception
      This adds initializing the override to null and defaulting to the Units category over root to finalizing the initialization of the AbstractIconChooserDialog
      Overrides:
      finalizeInitialization in class megamek.client.ui.baseComponents.AbstractDialog
      Throws:
      Exception - if there's an issue finishing initialization. Normally this means there's an issue setting the preferences, which normally means that a component has had its name value set.
    • okButtonActionPerformed

      protected void okButtonActionPerformed(@Nullable ActionEvent evt)
      Overrides:
      okButtonActionPerformed in class megamek.client.ui.dialogs.AbstractIconChooserDialog