forked from fanruan/finekit
richie
5 years ago
1 changed files with 67 additions and 0 deletions
@ -0,0 +1,67 @@ |
|||||||
|
package com.fanruan.api.design.ui.layout; |
||||||
|
|
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author richie |
||||||
|
* @version 10.0 |
||||||
|
* Created by richie on 2019-08-28 |
||||||
|
* 表格布局 |
||||||
|
*/ |
||||||
|
public class TableLayoutKit { |
||||||
|
|
||||||
|
/** |
||||||
|
* 按需计算尺寸 |
||||||
|
*/ |
||||||
|
public static final double PREFERRED = TableLayout.PREFERRED; |
||||||
|
|
||||||
|
/** |
||||||
|
* 按充满计算尺寸 |
||||||
|
*/ |
||||||
|
public static final double FILL = TableLayout.FILL; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建一个简单的表格布局并把组件添加到布局容器中 |
||||||
|
* |
||||||
|
* @param components 组件 |
||||||
|
* @param rowSize 行尺寸信息,可以是固定的数值,也可以是PREFERRED或者FILL常量 |
||||||
|
* @param columnSize 列尺寸信息,可以是固定的数值,也可以是PREFERRED或者FILL常量 |
||||||
|
* @return 按要求的布局添加好组件的容器 |
||||||
|
*/ |
||||||
|
public static JPanel createTableLayoutPane(Component[][] components, double[] rowSize, double[] columnSize) { |
||||||
|
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建一个简单的表格布局并把组件添加到布局容器中 |
||||||
|
* |
||||||
|
* @param components 组件 |
||||||
|
* @param rowSize 行尺寸信息,可以是固定的数值,也可以是PREFERRED或者FILL常量 |
||||||
|
* @param columnSize 列尺寸信息,可以是固定的数值,也可以是PREFERRED或者FILL常量 |
||||||
|
* @param gap 垂直和水平间隙 |
||||||
|
* @return 按要求的布局添加好组件的容器 |
||||||
|
*/ |
||||||
|
public static JPanel createCommonTableLayoutPane(Component[][] components, double[] rowSize, double[] columnSize, double gap) { |
||||||
|
|
||||||
|
return TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, gap); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建一个简单的表格布局并把组件添加到布局容器中 |
||||||
|
* |
||||||
|
* @param components 组件 |
||||||
|
* @param rowSize 行尺寸信息,可以是固定的数值,也可以是PREFERRED或者FILL常量 |
||||||
|
* @param columnSize 列尺寸信息,可以是固定的数值,也可以是PREFERRED或者FILL常量 |
||||||
|
* @param horizontalGap 水平间隙 |
||||||
|
* @param verticalGap 垂直间隙 |
||||||
|
* @return 按要求的布局添加好组件的容器 |
||||||
|
*/ |
||||||
|
public static JPanel createGapTableLayoutPane(Component[][] components, double[] rowSize, double[] columnSize, double horizontalGap, double verticalGap) { |
||||||
|
|
||||||
|
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, horizontalGap, verticalGap); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue