GridLayout的参数是什么?

时间:2008-12-11 21:00:19

标签: java layout grid-layout

private static final GridLayout layout = new GridLayout( 3, 1, 1, 0 );

在这行代码中,数字代表什么,以及如何使用它们来排列窗口中的复选框和按钮?

2 个答案:

答案 0 :(得分:8)

GridLayout课程:

public GridLayout(int rows,
                  int cols,
                  int hgap,
                  int vgap)

Creates a grid layout with the specified number of rows and columns. All components in the layout are given equal size.
In addition, the horizontal and vertical gaps are set to the specified values. Horizontal gaps are placed between each of the columns. Vertical gaps are placed between each of the rows.

One, but not both, of rows and cols can be zero, which means that any number of objects can be placed in a row or in a column.

All GridLayout constructors defer to this one.

Parameters:
rows - the rows, with the value zero meaning any number of rows
cols - the columns, with the value zero meaning any number of columns
hgap - the horizontal gap
vgap - the vertical gap

答案 1 :(得分:6)

豫ICP备18024241号-1