Java Layout Manager setlayout ()
1.FlowLayout
Public FlowLayout (int align,int hgap,int vgap)
Creates a new flow layout manager with the specified alignment and the specified horizontal and vertical clearances.
The value of the alignment parameter must be one of the following: Flowlayout.left, Flowlayout.right, Flowlayout.center, flowlayout.leading, or flowlayout.trailing.
Parameters:
Align-Alignment value
Hgap-the horizontal gap between components and the edges of the component and the Container
Vgap-the vertical gap between components and the edges of components and Container
2.GridLayout
public GridLayout (int rows,
int cols,
int Hgap,
int vgap) Creates a grid layout with the specified number of rows and columns. Assigns an equal size to all components in the layout.
Also, set the horizontal and vertical spacing to the specified value. Horizontal spacing is placed between columns. The vertical spacing is placed between rows and rows.
One of rows and cols can be 0 (but not both 0), which means that any number of objects can be placed in rows or columns.
All GridLayout construction methods obey this rule.
Parameters:
Rows-the rows has a value of 0 that represents any number of rows
Cols-The cols has a value that represents any number of columns 0
Hgap-Horizontal Spacing
Vgap-Vertical Spacing
3.BorderLayout
public borderlayout (int hgap,
int Vgap constructs a boundary layout with the horizontal spacing between the specified components. Horizontal spacing is specified by hgap, while vertical spacing is specified by Vgap.
Parameters:
Hgap-Horizontal spacing.
Vgap-Vertical spacing.
4.CardLayout
Public cardlayout (int hgap,
int vgap) Creates a new card layout with the specified horizontal and vertical gaps. The horizontal gap is placed on the left and right edges. The vertical gap is placed on the upper and lower edges.
Parameters:
HGAP-Horizontal clearance.
VGAP-vertical clearance.
Original: http://blog.sina.com.cn/s/blog_5e8cd8220101243t.html