Class GridBagUtils

java.lang.Object
org.esa.snap.ui.GridBagUtils

public class GridBagUtils extends Object
A utility class providing helper methods for JPanels with a GridBagLayout layout manager.
Version:
$Revision$ $Date$
  • Constructor Details

    • GridBagUtils

      public GridBagUtils()
  • Method Details

    • createPanel

      public static JPanel createPanel()
    • createDefaultEmptyBorderPanel

      public static JPanel createDefaultEmptyBorderPanel()
    • createConstraints

      public static GridBagConstraints createConstraints(String code)
      Creates a GridBagConstraints 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:

      Parameters:
      code - a textual representation of the attributes to be set
    • createDefaultConstraints

      public static GridBagConstraints createDefaultConstraints()
      Creates a GridBagConstraints instance with the following attributes:
    • 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 component
      comp - the component to be added
      gbc - the grid bag constraints to be used, can be null if code is not null
    • 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 also setAttributes(GridBagConstraints, String).

      Parameters:
      panel - the panel to which to add the component
      comp - the component to be added
      gbc - the grid bag constraints to be used, can be null if code is not null
      code - the code containing the constraints, can be null if gbc is not null
      See Also:
    • 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 given GridBagConstraints 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:

      Parameters:
      gbc - the grid bag constraints whose attributes are to be set, must not be null
      code - a textual representation of the attributes to be set