Class GridBagUtils


  • public class GridBagUtils
    extends Object
    A utility class providing helper methods for JPanels with a GridBagLayout layout manager.
    Version:
    $Revision$ $Date$
    • 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:

        Parameters:
        code - a textual representation of the attributes to be set
      • 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
      • 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