java - GridLayout 的参数是什么?

标签 java layout grid-layout

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

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

最佳答案

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

关于java - GridLayout 的参数是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/360877/

相关文章:

Java 日历网格布局

java - Hibernate 和 JUnit

android - 如何创建这样的按钮组?

css - 我怎样才能打破网格?有这方面的普遍做法吗?

html - 如何使一个 block 在 flexbox 显示中固定和 float ?

javascript - 如何通过拖动整个底部边框线而不是 react 中的右下角来调整div高度?

html - 可以在一排基础上将动态不均匀添加的列居中吗?

java - 哪些元素将被收集为垃圾(SCJP Book Q)

java - 集合中的独特集合

java - 计算文本中的逗号(多线程),我做得对吗?