Header Ads

  • Breaking Now

    How are the elements of a GridBagLayout organized?

    A GridBagLayout organizes/arranges all GUI controls to a grid. However, these controls are of different sizes and may occupy more than one row or column of the grid. These rows and columns may have different sizes as well.It is by far most powerful layout manager and requires good practice and understanding to use.It can combine the features of Border,Flow and Card layouts and capable of much more.
    GridBag layout divides its container into an array of cells, different cell rows can have different heights, and different cell columns can have different widths. A component can occupy part or all of a region.While a region is spanned over a single cell or a rectangle made up of multiple cells.A helper class called GridBagConstraints is used to hold all the layout position information.The add(Component, Object) version of the add() method is used for adding a control, passing an instance of GridBagConstraints as the Object parameter.

    Post Top Ad

    Post Bottom Ad