📄 gbc.java
字号:
package cn.com.util;
import java.awt.GridBagConstraints;
import java.awt.Insets;
public class GBC extends GridBagConstraints {
//设置起始点位置
public GBC(int gridx, int gridy) {
this.gridx = gridx;
this.gridy = gridy;
}
//起始点位置、所占行数和列数
public GBC(int gridx, int gridy, int gridwidth, int gridheight) {
this.gridx = gridx;
this.gridy = gridy;
this.gridwidth = gridwidth;
this.gridheight = gridheight;
}
//指定其在某一区域内的位置
public GBC setAnchor(int anchor) {
this.anchor = anchor;
return this;
}
//组件如何拉伸
public GBC setFill(int fill) {
this.fill = fill;
return this;
}
//如果设置为0则这个区域永远为初始尺寸,建议设置为100,随窗口变化
public GBC setWeight(int weightx, int weighty) {
this.weightx = weightx;
this.weighty = weighty;
return this;
}
//用于要求四周空间量相同时使用
public GBC setInsets(int distance) {
this.insets = new Insets(distance, distance, distance, distance);
return this;
}
//外部填塞,设置组件周围的空间量
public GBC setInsets(int top, int left, int bottom, int right) {
this.insets = new Insets(top, left, bottom, right);
return this;
}
//内部填塞,设置组件的最小宽度和高度
public GBC setIpad(int ipadx, int ipady) {
this.ipadx = ipadx;
this.ipady = ipady;
return this;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -