自备详细注释

 /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package swingtest1; import java.awt.GridBagConstraints;
import java.awt.Insets; /**
*
* @author DaChongZi
* @param gridx
* 行坐标
* @param gridy
* 列坐标
* @param gridwidth
* 占据多少列
* @param gridheight
* 占据多少行
* @param setAnchor
* 设置单元格内的对齐方式
* @param setFill
* 设置单元格内的填充行为
*/
public class GBC extends GridBagConstraints { /**
* 设置空间所在网格坐标
*
* @param gridx
* 横轴坐标
* @param gridy
* 纵轴坐标
*/
public GBC(int gridx, int gridy) {
this.gridx = gridx;
this.gridy = gridy;
} /**
* 设置控件所在坐标以及需要占用的行列格数
*
* @param gridx
* 横轴所在坐标
* @param gridy
* 纵轴所在坐标
* @param gridwidth
* 占用行格数
* @param gridheight
* 占用列格数
*/
public GBC(int gridx, int gridy, int gridwidth, int gridheight) {
this.gridx = gridx;
this.gridy = gridy;
this.gridwidth = gridwidth;
this.gridheight = gridheight;
} /**
* 单元格内的对其方式。
* 绝对位置:east,west,south,north,northeast,northwest,southeast,southwest
* 。默认为center。 相对位置:first_line_start,line_start,first_line_end,page_start
* ,enter,page_end,
* page_end,last_line_start,line_end,last_line_end。默认为center。
*
* @param anchor
* @return
*/
public GBC setAnchor(int anchor) {
this.anchor = anchor;
return this;
} /**
* 单元格内的填充行为。 取值为none,both,norizontal,vertical。默认值为none。 * 外部填充
* 如果显示区域比组件的区域大的时候,可以用来控制组件的行为。控制组件是垂直填充,还是水平填充,或者两个方向一起填充。
*
* @param fill
* @return
*/
public GBC setFill(int fill) {
this.fill = fill;
return this;
} /**
* 指组件与表格空间四周边缘的空白区域的大小
*
* @param top
* @param bottom
* @param left
* @param right
* @return
*/
public GBC setInsets(int top, int bottom, int left, int right) {
this.insets = new Insets(top, bottom, left, right);
return this;
} /**
* 组件的横向、纵向间距
*
* @param ipadx
* @param ipady
* @return
*/
public GBC setIpad(int ipadx, int ipady) {
this.ipadx = ipadx;
this.ipady = ipady;
return this;
}
}

GridBagLayout的帮助类的更多相关文章

  1. Java类的继承与多态特性-入门笔记

    相信对于继承和多态的概念性我就不在怎么解释啦!不管你是.Net还是Java面向对象编程都是比不缺少一堂课~~Net如此Java亦也有同样的思想成分包含其中. 继承,多态,封装是Java面向对象的3大特 ...

  2. [转]JAVA布局模式:GridBagConstraints终极技巧

    最近正在 修改<公交线路查询系统>,做系统的时候都是用NULL布局,由于NULL布局调用windows系统的API,所以生成的程序无法在其他平台上应用,而 且如果控件的数量很多,管理起来也 ...

  3. [转]java gridbag 说明

    gridx = 2; // X2 gridy = 0; // Y0 gridwidth = 1; // 横占一个单元格 gridheight = 1; // 列占一个单元格 weightx = 0.0 ...

  4. Java学习笔记--Java图形用户界面

    AWT:抽象窗口组件工具包 Abstract Windows Toolkit(AWT)是最原始的 Java GUI 工具包.AWT 的主要优点是,它在 Java 技术的每个版本上都成为了一种标准配置, ...

  5. Java图形化界面设计——GridBagConstraints

    JAVA布局模式:GridBagConstraints终极技巧参数详解 布局模式 :GridBagConstraints布局,先发一个实例: gridx = 2; // X2 gridy = 0; / ...

  6. Java GridBagLayout 简单使用

    这里只介绍了很基础布局构建及使用,主要是关于 GridBagLayout. 首先整套流程大概是, 声明一个 GridBagLayout 对象 private GridBagLayout gridBag ...

  7. GridBagLayout()的使用方法

    GridBagLayout是java里面最重要的布局管理器之一,可以做出很复杂的布局,可以说GridBagLayout是必须要学好的的, GridBagLayout 类是一个灵活的布局管理器,它不要求 ...

  8. java生成字符串md5函数类(javaSE)

    //实现生成MD5值 import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.B ...

  9. javax.Swing 使用GridBagLayout的程序栗子

    摘自https://zhidao.baidu.com/question/110748776.html javax.Swing 使用GridBagLayout的程序栗子 总共两个文件,第一个是启动文件, ...

随机推荐

  1. Linux 查看磁盘分区、文件系统、使用情况的命令和相关工具介绍

    磁盘分区表.文件系统的查看.统计的工具很多,有些工具是多功能的,不仅仅是查看磁盘的分区表,而且也能进行磁盘分区的操作:但在本文,我们只讲磁盘分区的查看,以及分区的使用情况的查看:本文只是给新手上路之用 ...

  2. Delphi 编写的Web Service

      一编写服务程序 第一步:File----->New----->Other------>WebServices----->Soap Server Application选择I ...

  3. Difference Between Primes

    Problem Description All you know Goldbach conjecture.That is to say, Every even integer greater than ...

  4. TCP11种状态分析和测试

    -->简介 -->正文 -->测试一些状态 --------------------------------------------------------------------- ...

  5. UVa816 Abbott's Revenge

    Abbott's Revenge Time limit: 3.000 seconds Abbott’s Revenge  Abbott’s Revenge The 1999 World FinalsC ...

  6. CSS3弹性盒模型之Flexbox是布局模块box-sizing & box-orient & box-direction & box-ordinal-group

    css3 box-sizing属性 box-sizing属性可以为三个值之一:content-box(default),border-box,padding-box. content-box,bord ...

  7. VS2012的安装项目只能用InstallShield Limited Edition[附资源下载]

    以前版本的Visual Stuido中安装项目都可以使用微软自家的Visual Studio Installer,但是到了VS2012这一切都变了,只能用InstallShield Limited E ...

  8. WinForm中关于控件焦点的问题

    方法一: 在打开一个窗体时,我们往往需要设置焦点让光标出现在我们希望它出现的位置上. 这时我们可以在窗体的Activated事件中设置焦点 例如我们希望光标在打开窗体的时候出现在textBox1上,我 ...

  9. winform渐变窗口显示/关闭

    //渐渐的消失 for (int iNum = 10; iNum >= 0; iNum --) { //变更窗体的不透明度 this.Opacity = 0.1 * iNum; //暂停 Sys ...

  10. 搜索框中“请输入搜索keyword”

    $(function(){    $("#ctl00_txtKey").val("请输入搜索keyword").addClass("search&qu ...