Monday, May 7, 2007

What is the difference between GridLayout and GridBagLayout?

GridLayout class lays all components in a rectangular grid like structure of container. The container 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 area.

Each component managed by a GridBagLayout is associated with an instance of GridBagConstraints. The constraints object specifies where a component's display area should be located on the grid and how the component should be positioned within its display area. In addition to its constraints object, the GridBagLayout also considers each component's minimum and preferred sizes in order to determine a component's size.

2 comments :

George on June 16, 2009 at 7:36 AM said...

Nice summarization, thanks!

Anonymous said...

Thank you very helpful

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2017. Reads: best tracker