Class AbstractPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
abstractIconChooserPanel, AbstractScrollablePanel, SkillGenerationOptionsPanel

public abstract class AbstractPanel extends JPanel
This is the default Panel. It handles preferences, resources, and the frame.

Inheriting classes must call initialize() in their constructor and override initialize().

This is directly tied to MekHQ's AbstractMHQPanel, and any changes here MUST be verified there.

See Also:
  • Field Details

  • Constructor Details

    • AbstractPanel

      protected AbstractPanel(JFrame frame, String name)
      This creates an AbstractPanel using the default resource bundle.
    • AbstractPanel

      protected AbstractPanel(JFrame frame, String name, boolean isDoubleBuffered)
      This creates an AbstractPanel using the default resource bundle and specified double buffered boolean.
    • AbstractPanel

      protected AbstractPanel(JFrame frame, String name, LayoutManager layoutManager)
      This creates an AbstractPanel using the default resource bundle and specified layout manager.
    • AbstractPanel

      protected AbstractPanel(JFrame frame, String name, LayoutManager layoutManager, boolean isDoubleBuffered)
      This creates an AbstractPanel using the default resource bundle and specified layout manager and double buffered boolean.
    • AbstractPanel

      protected AbstractPanel(JFrame frame, ResourceBundle resources, String name, LayoutManager layoutManager, boolean isDoubleBuffered)
      This creates an AbstractPanel using the specified resource bundle, layout manager, and double buffered boolean. This is not recommended by default.
  • Method Details

    • getFrame

      public JFrame getFrame()
    • initialize

      protected abstract void initialize()
      This initializes the panel, and must be called by inheriting constructors. This MUST end with a call to setPreferences() for this class to work properly.
    • setPreferences

      protected void setPreferences() throws Exception
      This is used to set preferences based on the preference node for this class. It is overridden for MekHQ usage
      Throws:
      Exception - if there's an issue initializing the preferences. Normally this means a component has not had its name value set.
    • setPreferences

      protected void setPreferences(PreferencesNode preferences) throws Exception
      This sets the base preferences for this class, and calls the custom preferences method
      Throws:
      Exception - if there's an issue initializing the preferences. Normally this means a component has not had its name value set.
    • setCustomPreferences

      protected void setCustomPreferences(PreferencesNode preferences) throws Exception
      Adds custom preferences to the child panel.

      By default, this panel will track no preferences Other preferences can be added by overriding this method.

      Parameters:
      preferences - the preference node for this panel
      Throws:
      Exception - if there's an issue initializing the preferences. Normally this means a component has not had its name value set.