Java Layout Manager setlayout ()

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.