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 forJPanel
s with aGridBagLayout
layout manager.- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description GridBagUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addHorizontalFiller(JPanel panel, GridBagConstraints gbc)
static void
addToPanel(JPanel panel, Component comp, GridBagConstraints gbc)
Adds a component to a panel with a grid bag layout.static void
addToPanel(JPanel panel, Component comp, GridBagConstraints gbc, String code)
Adds a component to a panel with a grid bag layout.static void
addVerticalFiller(JPanel panel, GridBagConstraints gbc)
static GridBagConstraints
createConstraints(String code)
Creates aGridBagConstraints
instance with the attributes given as a comma separated key-value pairs in a text string.static GridBagConstraints
createDefaultConstraints()
Creates aGridBagConstraints
instance with the following attributes:anchor
=WESTinsets.top
=0insets.left
=3insets.bottom
=0insets.right
=3static JPanel
createDefaultEmptyBorderPanel()
static JPanel
createPanel()
static GridBagConstraints
setAttributes(GridBagConstraints gbc, String code)
Sets the attributes of a givenGridBagConstraints
instance 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 aGridBagConstraints
instance with the attributes given as a comma separated key-value pairs in a text string.According to the public
GridBagConstraints
attributes, 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 aGridBagConstraints
instance 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 benull
ifcode
is 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
code
parameter, 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 benull
ifcode
is notnull
code
- the code containing the constraints, can benull
ifgbc
is 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 givenGridBagConstraints
instance to the attribute values given as a comma separated key-value pairs in a text string.According to the public
GridBagConstraints
attributes, 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
-
-