We had seen many Layouts in past examples on Java AWT. The GridBagLayout is the most flexible layout in the Java AWT packages. But this comes with the cost of complexity held in the setup of GridBagLayout. You can imagine GridBagLayout as GridLayout with change in cell sizes. Here, we can add controls in relation with the existing one.
The GridBagLayout makes use of the specific settings for each controls which can be set using the GridBagConstraints class. Before adding the controls to the GridBagLayout class, we need to set these component specific setup rules. The bag layout will make use of these setup factors to arrange the components in the parent container.