自备详细注释

 /*
* 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. REST client 基于浏览器的测试工具

    以前在开发webservice服务,都是自己基于HTTP协议,自己写一个测试程序来进行测试,最近在研究RestFul,对以前webservice服务进行了重构,总结了不少经验,今天就给大家介绍下几款R ...

  2. Selenium 前期学习

    一.了解selenium必读文档: 官方文档:http://docs.seleniumhq.org/docs/03_webdriver.jsp 二.公司使用c#开发,配合开发的要求,使用visual ...

  3. lightoj 1036 dp

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1036 #include <cstdio> #include <cst ...

  4. XMPP and Asterisk integration

    http://www.mundoopensource.com.br/en_page_xmpp_asterisk_pratical_example/ www.mundoopensource.com.br ...

  5. shiro能做什么,做j2ee时候要考虑什么

    转载: http://jinnianshilongnian.iteye.com/blog/2018398,         感谢原作者 <跟我学Shiro>PDF完结版下载 博客分类: 跟 ...

  6. jsp的include两种使用方法区别

    指令include是将被包含页面中的代码复制粘贴到主页面中,最后编译形成主页面的类文件(一个). 指令include中file属性的值必须是项目中已存在的文件,否则主页面报异常. 指令include如 ...

  7. HTML --- 盒模型

    绝对对位 position:absolute; 当一个元素设定了绝对对位, 如果他的父元素有设置定位(不管是绝对还是相对定位),那么他的坐标就是相当于父元素的左上角 进行定位(即 left:1px;t ...

  8. C# Timer执行方法

    private void button3_Click(object sender, EventArgs e) { System.Timers.Timer t = new System.Timers.T ...

  9. Away3D 的实体收集器流程1

    View3D 顾名思义 它就是一个3D视口,视口的默认值是无穷大的,即相当于“窗口”是无限大的,我们看到的将是外面的所有景物即flash尺寸是视口的有效视域.传统电视的高宽比为4:3,现在的高清电视的 ...

  10. 常用iptables规则整理

    1.仅允许内部合法的IP地址访问服务器 #setting access rules #one,in access rules,allow all the ips of hudong.com iptab ...