GridBagLayout的帮助类
自备详细注释
/*
* 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的帮助类的更多相关文章
- Java类的继承与多态特性-入门笔记
相信对于继承和多态的概念性我就不在怎么解释啦!不管你是.Net还是Java面向对象编程都是比不缺少一堂课~~Net如此Java亦也有同样的思想成分包含其中. 继承,多态,封装是Java面向对象的3大特 ...
- [转]JAVA布局模式:GridBagConstraints终极技巧
最近正在 修改<公交线路查询系统>,做系统的时候都是用NULL布局,由于NULL布局调用windows系统的API,所以生成的程序无法在其他平台上应用,而 且如果控件的数量很多,管理起来也 ...
- [转]java gridbag 说明
gridx = 2; // X2 gridy = 0; // Y0 gridwidth = 1; // 横占一个单元格 gridheight = 1; // 列占一个单元格 weightx = 0.0 ...
- Java学习笔记--Java图形用户界面
AWT:抽象窗口组件工具包 Abstract Windows Toolkit(AWT)是最原始的 Java GUI 工具包.AWT 的主要优点是,它在 Java 技术的每个版本上都成为了一种标准配置, ...
- Java图形化界面设计——GridBagConstraints
JAVA布局模式:GridBagConstraints终极技巧参数详解 布局模式 :GridBagConstraints布局,先发一个实例: gridx = 2; // X2 gridy = 0; / ...
- Java GridBagLayout 简单使用
这里只介绍了很基础布局构建及使用,主要是关于 GridBagLayout. 首先整套流程大概是, 声明一个 GridBagLayout 对象 private GridBagLayout gridBag ...
- GridBagLayout()的使用方法
GridBagLayout是java里面最重要的布局管理器之一,可以做出很复杂的布局,可以说GridBagLayout是必须要学好的的, GridBagLayout 类是一个灵活的布局管理器,它不要求 ...
- java生成字符串md5函数类(javaSE)
//实现生成MD5值 import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.B ...
- javax.Swing 使用GridBagLayout的程序栗子
摘自https://zhidao.baidu.com/question/110748776.html javax.Swing 使用GridBagLayout的程序栗子 总共两个文件,第一个是启动文件, ...
随机推荐
- (转载)INSERT INTO .. ON DUPLICATE KEY 语法与实例教程
(转载)http://www.111cn.net/database/mysql/ON_DUPLICATE_KEY%20.htm INSERT语句末尾指定了ON DUPLICATE KEY UPDATE ...
- lightoj 1033 区间dp
题目链接:http://lightoj.com/volume_showproblem.php?problem=1033 #include <cstdio> #include <cst ...
- nyoj 95 众数问题【水】
众数问题 时间限制:3000 ms | 内存限制:65535 KB 难度:3 描述 所谓众数,就是对于给定的含有N个元素的多重集合,每个元素在S中出现次数最多的成为该元素的重数, 多重集合S重 ...
- ecshop检验邮件是否合法
<?php /** * 验证输入的邮件地址是否合法 * * @access public * @param string $email 需要验证的邮件地址 * * @return bool */ ...
- 帮助招聘程序员的自动考试网站:Codility
Automated tests of programming skills. Assessment of software developers. Recruitment software. Codi ...
- 打开WEBBROWSER的选中文件路径
uses CommCtrl, httpApp, ShellApi; { GetWebPath(WebBrowser1); } function GetWebPath(web: TWebBrows ...
- AE二次开发中,过滤后的图层,实现缩放至图层效果
//featureClass是自己获取的featureClass,也可是sde中获取的. public void FilterAndZoomToLayer(IFeatureClass featureC ...
- 进程的优先级 与 CFS 进程调度
在Linux下改变进程的优先级 作者:曾老师,华清远见嵌入式学院讲师. 作为多任务的操作系统,Linux内核为每个创建的进程分配时间片并根据其优先级进行调度.当进程被创建时,其对应的task_stru ...
- mac tips
1. Mac Terminal color for different types 在 ~ 先建立一个文件 ~/.bash_profile 加入下面的两行:export CLICOLOR=1expo ...
- BootStrap table 传递搜索参数
看bootStrap table文档不难发现它有一个queryparams属性,是向后台传递参数的,默认参数已有pageSize.pageIndex等,那么怎么传递自定义的参数呢?在网上找了好多也没有 ...