一、对上一篇文章给出的EasyGridLayout源程序,加载到项目 。
二、setConstraints方法的调用参数说明 ,
因为public class EasyGridLayout extends GridBagLayout,声明Component对象,声明EasyGridLayout对象,给出具体参数调用 setConstraints(Component c, int row, int col, int width, int height) 方法即可实现强大的布局功能。
以下是参数的说明:
1.Component是给出了的(如果要添加就调用finishSet方法重写即可).
2.row对应GridBagLayout中的gridy,设置到top的单元格数,也就是row,初始值为1。
col对应GridBagLayout中的gridx,初始值为1。
3.width对应GridBagLayout中的gridwidth,设置在Horizontal所占的单元格数。
height对应GridBagLayout中的gridheight。
4.其中,weight,height;fill;anchor字段在对应组件的重载finishSet方法中已做了具体的设置,自己也可以重载finishSet重新设置这些字段。
三、以下是EasyGridLayout已写组件API的帮助信息,
by Jerome Cen,2011.8.2