⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gbc.java

📁 java 版ATM 系统 注册登陆 存取!!!据对经典
💻 JAVA
字号:
import java.awt.*;

/**
  定义这个GBC类,使得更方便操作 GridBagConstraints类的对象
*/
public class GBC extends GridBagConstraints 
{
   /**
	构造函数对gridx,gridy的数值进行初始化.其他数值取默认数值
	gridx : 指定包含组件的显示区域开始边的单元格,其中行的第一个单元格为 gridx=0。(第几列)
	gridy : 指定位于组件显示区域的顶部的单元格,其中最上边的单元格为 gridy=0。(第几行)
   */
   public GBC(int gridx, int gridy)
   {
      this.gridx = gridx;
      this.gridy = gridy;
   }

   /**
	构造函数对gridx,gridy,gridwidth,gridheight的数值进行初始化.其他数值取默认数值
	gridy : 指定包含组件的显示区域开始边的单元格,其中行的第一个单元格为 gridx=0。
	gridy : 指定位于组件显示区域的顶部的单元格,其中最上边的单元格为 gridy=0。
	gridwidth : 指定组件显示区域的某一行中的单元格数。
	gridheight :指定在组件显示区域的某一列中的单元格数。
   */
   public GBC(int gridx, int gridy, int gridwidth, int gridheight)
   {
      this.gridx = gridx;
      this.gridy = gridy;
      this.gridwidth = gridwidth; 
      this.gridheight = gridheight; 
   }

   /**
      设置 anchor 的值
      anchor : 当组件小于其显示区域时使用此字段。(编译器有一些默认的值)
       返回修改好对象,为以后使用
   */
   public GBC setAnchor(int anchor) 
   { 
      this.anchor = anchor; 
      return this;
   }
   
   /**
      设置 fill 的数值
      fill : 当组件的显示区域大于它所请求的显示区域的大小时使用此字段。
	  它可以确定是否调整组件大小,一直怎么调整 
	  (如: NONE:不调整组件大小。BOTH:使组件完全填满其显示区域。 )
      返回修改好对象,为以后使用
   */
   public GBC setFill(int fill) 
   { 
      this.fill = fill; 
      return this;
   }

   /**
      设置组件的大小 (weightx 和 weighty 的数值用来决定组件占用的行数和列数)
      weightx : 指定如何分布额外的水平空间。
      weighty : 指定如何分布额外的垂直空间。
      返回修改好对象,为以后使用
   */
   public GBC setWeight(double weightx, double 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;
   }

   /**
    设置组件内部的空间扩展填充.
	ipadx : 此字段指定组件的内部填充,即给组件的最小宽度添加多大的空间。
	ipady : 此字段指定内部填充,即给组件的最小高度添加多大的空间。
	返回修改好对象,为以后使用
   */
   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 + -