Package org.esa.snap.ui
Class GridBagUtils
- java.lang.Object
-
- org.esa.snap.ui.GridBagUtils
-
public class GridBagUtils extends Object
A utility class providing helper methods forJPanels with aGridBagLayoutlayout manager.- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description GridBagUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddHorizontalFiller(JPanel panel, GridBagConstraints gbc)static voidaddToPanel(JPanel panel, Component comp, GridBagConstraints gbc)Adds a component to a panel with a grid bag layout.static voidaddToPanel(JPanel panel, Component comp, GridBagConstraints gbc, String code)Adds a component to a panel with a grid bag layout.static voidaddVerticalFiller(JPanel panel, GridBagConstraints gbc)static GridBagConstraintscreateConstraints(String code)Creates aGridBagConstraintsinstance with the attributes given as a comma separated key-value pairs in a text string.static GridBagConstraintscreateDefaultConstraints()Creates aGridBagConstraintsinstance with the following attributes:anchor=WESTinsets.top=0insets.left=3insets.bottom=0insets.right=3static JPanelcreateDefaultEmptyBorderPanel()static JPanelcreatePanel()static GridBagConstraintssetAttributes(GridBagConstraints gbc, String code)Sets the attributes of a givenGridBagConstraintsinstance to the attribute values given as a comma separated key-value pairs in a text string.
-
-
-
Method Detail
-
createPanel
public static JPanel createPanel()
-
createDefaultEmptyBorderPanel
public static JPanel createDefaultEmptyBorderPanel()
-
createConstraints
public static GridBagConstraints createConstraints(String code)
Creates aGridBagConstraintsinstance with the attributes given as a comma separated key-value pairs in a text string.According to the public
GridBagConstraintsattributes, the following key-value pairs are can occur in the text string:gridx=RELATIVE|integergridy=RELATIVE|integergridwidth=REMAINDER|RELATIVE|integergridheight=REMAINDER|RELATIVE|integerweightx=doubleweighty=doubleanchor=CENTER|NORTH|NORTHEAST|EAST|SOUTHEAST|SOUTH|SOUTHWEST|WEST|NORTHWEST|integerfill=NONE|HORIZONTAL|VERTICAL|BOTH|integerinsets.bottom=integerinsets.left=integerinsets.right=integerinsets.top=integeripadx=integeripady=integer
- Parameters:
code- a textual representation of the attributes to be set
-
createDefaultConstraints
public static GridBagConstraints createDefaultConstraints()
Creates aGridBagConstraintsinstance with the following attributes:anchor=WESTinsets.top=0insets.left=3insets.bottom=0insets.right=3
-
addToPanel
public static void addToPanel(JPanel panel, Component comp, GridBagConstraints gbc)
Adds a component to a panel with a grid bag layout.- Parameters:
panel- the panel to which to add the componentcomp- the component to be addedgbc- the grid bag constraints to be used, can benullifcodeis notnull
-
addToPanel
public static void addToPanel(JPanel panel, Component comp, GridBagConstraints gbc, String code)
Adds a component to a panel with a grid bag layout.For the
codeparameter, see alsosetAttributes(GridBagConstraints, String).- Parameters:
panel- the panel to which to add the componentcomp- the component to be addedgbc- the grid bag constraints to be used, can benullifcodeis notnullcode- the code containing the constraints, can benullifgbcis notnull- See Also:
setAttributes(GridBagConstraints, String)
-
addHorizontalFiller
public static void addHorizontalFiller(JPanel panel, GridBagConstraints gbc)
-
addVerticalFiller
public static void addVerticalFiller(JPanel panel, GridBagConstraints gbc)
-
setAttributes
public static GridBagConstraints setAttributes(GridBagConstraints gbc, String code)
Sets the attributes of a givenGridBagConstraintsinstance to the attribute values given as a comma separated key-value pairs in a text string.According to the public
GridBagConstraintsattributes, the following key-value pairs are can occur in the text string:gridx=RELATIVE|integergridy=RELATIVE|integergridwidth=REMAINDER|RELATIVE|integergridheight=REMAINDER|RELATIVE|integerweightx=doubleweighty=doubleanchor=CENTER|NORTH|NORTHEAST|EAST|SOUTHEAST|SOUTH|SOUTHWEST|WEST|NORTHWEST|integerfill=NONE|HORIZONTAL|VERTICAL|BOTH|integerinsets.bottom=integerinsets.left=integerinsets.right=integerinsets.top=integeripadx=integeripady=integer
- Parameters:
gbc- the grid bag constraints whose attributes are to be set, must not be nullcode- a textual representation of the attributes to be set
-
-