org.esa.beam.framework.ui
Class GridBagUtils

java.lang.Object
  extended by org.esa.beam.framework.ui.GridBagUtils

public class GridBagUtils
extends Object

A utility class providing helper methods for JPanels with a GridBagLayout layout manager.

Version:
$Revision$ $Date$
Author:
Sabine Embacher

Constructor Summary
GridBagUtils()
           
 
Method Summary
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 a GridBagConstraints instance with the attributes given as a comma separated key-value pairs in a text string.
static GridBagConstraints createDefaultConstraints()
          Creates a GridBagConstraints instance with the following attributes: anchor=WEST insets.top=0 insets.left=3 insets.bottom=0 insets.right=3
static JPanel createDefaultEmptyBorderPanel()
           
static JPanel createPanel()
           
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridBagUtils

public GridBagUtils()
Method Detail

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:

  • gridx=RELATIVE|integer
  • gridy=RELATIVE|integer
  • gridwidth=REMAINDER|RELATIVE|integer
  • gridheight=REMAINDER|RELATIVE|integer
  • weightx=double
  • weighty=double
  • anchor=CENTER|NORTH|NORTHEAST|EAST|SOUTHEAST|SOUTH|SOUTHWEST|WEST|NORTHWEST|integer
  • fill=NONE|HORIZONTAL|VERTICAL|BOTH|integer
  • insets.bottom=integer
  • insets.left=integer
  • insets.right=integer
  • insets.top=integer
  • ipadx=integer
  • ipady=integer
  • Parameters:
    code - a textual representation of the attributes to be set

    createDefaultConstraints

    public static GridBagConstraints createDefaultConstraints()
    Creates a GridBagConstraints instance with the following attributes:
  • anchor=WEST
  • insets.top=0
  • insets.left=3
  • insets.bottom=0
  • insets.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 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:
    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 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:

  • gridx=RELATIVE|integer
  • gridy=RELATIVE|integer
  • gridwidth=REMAINDER|RELATIVE|integer
  • gridheight=REMAINDER|RELATIVE|integer
  • weightx=double
  • weighty=double
  • anchor=CENTER|NORTH|NORTHEAST|EAST|SOUTHEAST|SOUTH|SOUTHWEST|WEST|NORTHWEST|integer
  • fill=NONE|HORIZONTAL|VERTICAL|BOTH|integer
  • insets.bottom=integer
  • insets.left=integer
  • insets.right=integer
  • insets.top=integer
  • ipadx=integer
  • ipady=integer
  • 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


    Copyright © 2002-2013 Brockmann Consult GmbH. All Rights Reserved.