HI
Can anybody Explain me the GridBagLayout() manager in detail.I mean How to use it.What are the differents constraints like gridx,gridy etc and how to implement them in program.
Types of layout managers
The type of layout manager that the parent container uses will determine where the components are positioned within that container.
1. GridLayout
2. FlowLayout
3. BorderLayout
4. GridBagLayout
5. CardLayout
6. No LayoutManager (null)
GridLayout
========
GridLayout ()
GridLayout (int rows, int cols)
GridLayout (int rows, int cols, int hgap, int vgap)
The GridLayout manager arranges components in a grid within a container.
Each cell in the grid is of equal dimensions.
The GridLayout manager ignores the preferred size of each component and resizes them to exactly fit each cell's dimensions.
The GridLayout manager inserts them across each column until that row is filled and then starts at the first column of the next row.
Note:
The setRows () and setColumns () methods does not guarantee that you will get the expected number of columns. The number of columns is calculated by the number of rows and the number of components added. The number of columns specified is respected only if the number of rows is not specified.
Example,
Frame f = new Frame ("GridLayout Example");
f.setBounds (0, 0, 300, 300);
f.setLayout (new GridLayout (3, 3)); // 3 rows x 3 columns