Number Of Page View:100,000+/Months
LOGIN |New User


What is the difference between GridLayout and GridBagLayout?
GridLayout class puts all the components in a 
rectangular grid and is divided into an equal 
sized rectangles and each component is placed 
inside a rectangle.

The GridBagLayout class is a flexible layout 
manager that aligns components vertically and 
horizontally, without requiring that the 
components be of the same size. Each 
GridBagLayout object maintains a dynamic, 
rectangular grid of cells, with each component 
occupying one or more cells, called its display 

GridLayout has the constructors :GridLayout(int 
rows, int cols) and GridLayout(int rows, int 
cols, int hgap, int vgap)

The major difference between GridLayout and 
GridBagLayout is that GrigBagLayout supports 
components of different sizes, and you can 
specify layout options for each component. 
Use the GridBagLayout when you need tabular 
layouts (or layouts that can be thought of as 
matrices) and when it is important to specify 
the resizing behavior of each component.