Class PanelManager

java.lang.Object
gov.nih.mipav.view.components.PanelManager

public class PanelManager extends Object
Manages the adding of components to a panel, automatically tranlating between logical element placement and the panel's layout.
Author:
mccreedy
  • Field Details

  • Constructor Details

    • PanelManager

      public PanelManager()
      Construct the panel manager with a new panel.
    • PanelManager

      public PanelManager(String title)
      Construct the panel manager with a new panel that has a titled border.
      Parameters:
      title - the title to put on the new panel's border
    • PanelManager

      public PanelManager(JPanel panel)
      Construct the panel manager and attach it to a panel which has already been created.
      Parameters:
      panel - the panel to manage
  • Method Details

    • add

      public void add(JComponent component)
      Adds a new component to the panel.
      Parameters:
      component - the component to add
    • add

      public void add(JComponent component, int anchorPosition)
      Adds a new component to the panel.
      Parameters:
      component - the component to add
      anchorPosition - the position to anchor the component to (from GridBagConstraints)
    • addOnNextLine

      public void addOnNextLine(JComponent component)
      Adds a new component to the panel on a new line (vertically).
      Parameters:
      component - the component to add
    • addOnNextLine

      public void addOnNextLine(JComponent component, int anchorPosition)
      Adds a new component to the panel on a new line (vertically).
      Parameters:
      component - the component to add
      anchorPosition - the position to anchor the component to (from GridBagConstraints)
    • getConstraints

      public GridBagConstraints getConstraints()
      Returns the current constraints of this panel manager.
      Returns:
      the current grid bag constraints
    • getPanel

      public JPanel getPanel()
      Returns the managed panel.
      Returns:
      the managed panel
    • setPanel

      public void setPanel(JPanel panel)
      Changes the panel which is managed by this class. Forces the panel to use a grid bag layout.
      Parameters:
      panel - the panel to manage
    • initConstraints

      private GridBagConstraints initConstraints()
      Create a new set of grid bag constraints.
      Returns:
      new layout constraints
    • initPanel

      private JPanel initPanel()
      Create a new panel.
      Returns:
      a new panel, with a grid bag layout
    • moveToNextLine

      private void moveToNextLine()
      Force new components which are added to appear on the next line in the panel (vertically).