The GridLayout class is used to align components horizontally, vertically, or along with their baseline.
The component may not be the same in size. Each of GridBagLayout object maintains a dynamic rectangle grid of cells. Each component occupies one or more cells that is known as its display region. Each component associate with an instance of GridBagConstraints.by using the Constraints object you can arrange the component’s display area on the grid. The GridBagLayout manages each component’s minimum & preferred sizes in the order to determine the size of the component.