一、列與行的參數都由三個部分組成:對齊方式、固定尺寸、調整方式。
1.對齊方式:
1)列對齊有left, center, right, fill.默認fill
2)行對齊有:top, center, bottom, fill. 其中fill表示填充至整個區域。默認center。
2.固定尺寸:
pref表示preferred size,適當大小,即首選尺寸大小。
min表示minimum size,
dlu 表示dialog units,
px, pt, in, mm, cm)分別表示Pixel, Points, Inches, Millimeter, Centimeter。
3. 調整方式:
二、CellConstraints:
cc.xywh(3, 1, 3, 1):表示3列,1行,colspan=3,rowspan=1
三、FormLayout:
1.FormLayout layout = new FormLayout(
new ColumnSpec[]{
FormSpecs.DEFAULT_COLSPEC,
FormSpecs.GLUE_COLSPEC,
FormSpecs.DEFAULT_COLSPEC,
FormSpecs.GLUE_COLSPEC,
FormSpecs.DEFAULT_COLSPEC,
FormSpecs.GLUE_COLSPEC},
new RowSpec[]{
FormSpecs.DEFAULT_ROWSPEC,
FormSpecs.GLUE_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC,
FormSpecs.GLUE_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC,
FormSpecs.GLUE_ROWSPEC
}
);
2.
FormLayout layout = new FormLayout(
"right:pref, 6dlu, 50dlu, 4dlu, center:50dlu", // columns
"pref, 3dlu, pref, 3dlu, pref"); // rows
參考文章:
http://hi.baidu.com/lijunwyf/item/a18d95f719ff01da6225d26fGavin