Package gov.nih.mipav.view.components
Class PanelManager
- java.lang.Object
-
- gov.nih.mipav.view.components.PanelManager
-
public class PanelManager extends java.lang.ObjectManages the adding of components to a panel, automatically tranlating between logical element placement and the panel's layout.- Author:
- mccreedy
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.GridBagConstraintsgbcDOCUMENT ME!private javax.swing.JPanelmanagedPanelDOCUMENT ME!
-
Constructor Summary
Constructors Constructor Description PanelManager()Construct the panel manager with a new panel.PanelManager(java.lang.String title)Construct the panel manager with a new panel that has a titled border.PanelManager(javax.swing.JPanel panel)Construct the panel manager and attach it to a panel which has already been created.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(javax.swing.JComponent component)Adds a new component to the panel.voidadd(javax.swing.JComponent component, int anchorPosition)Adds a new component to the panel.voidaddOnNextLine(javax.swing.JComponent component)Adds a new component to the panel on a new line (vertically).voidaddOnNextLine(javax.swing.JComponent component, int anchorPosition)Adds a new component to the panel on a new line (vertically).java.awt.GridBagConstraintsgetConstraints()Returns the current constraints of this panel manager.javax.swing.JPanelgetPanel()Returns the managed panel.private java.awt.GridBagConstraintsinitConstraints()Create a new set of grid bag constraints.private javax.swing.JPanelinitPanel()Create a new panel.private voidmoveToNextLine()Force new components which are added to appear on the next line in the panel (vertically).voidsetPanel(javax.swing.JPanel panel)Changes the panel which is managed by this class.
-
-
-
Constructor Detail
-
PanelManager
public PanelManager()
Construct the panel manager with a new panel.
-
PanelManager
public PanelManager(java.lang.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(javax.swing.JPanel panel)
Construct the panel manager and attach it to a panel which has already been created.- Parameters:
panel- the panel to manage
-
-
Method Detail
-
add
public void add(javax.swing.JComponent component)
Adds a new component to the panel.- Parameters:
component- the component to add
-
add
public void add(javax.swing.JComponent component, int anchorPosition)Adds a new component to the panel.- Parameters:
component- the component to addanchorPosition- the position to anchor the component to (from GridBagConstraints)
-
addOnNextLine
public void addOnNextLine(javax.swing.JComponent component)
Adds a new component to the panel on a new line (vertically).- Parameters:
component- the component to add
-
addOnNextLine
public void addOnNextLine(javax.swing.JComponent component, int anchorPosition)Adds a new component to the panel on a new line (vertically).- Parameters:
component- the component to addanchorPosition- the position to anchor the component to (from GridBagConstraints)
-
getConstraints
public java.awt.GridBagConstraints getConstraints()
Returns the current constraints of this panel manager.- Returns:
- the current grid bag constraints
-
getPanel
public javax.swing.JPanel getPanel()
Returns the managed panel.- Returns:
- the managed panel
-
setPanel
public void setPanel(javax.swing.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 java.awt.GridBagConstraints initConstraints()
Create a new set of grid bag constraints.- Returns:
- new layout constraints
-
initPanel
private javax.swing.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).
-
-