欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

SWT(JFace)體驗(yàn)之FillLayout布局

 更新時(shí)間:2009年06月25日 11:11:07   作者:  
FillLayout是非常簡(jiǎn)單的一種布局方式,它會(huì)以同樣大小對(duì)父組件中的子組件進(jìn)行布局,這些子組件將以一行或一列的形式排列。
FillLayout布局

FillLayout是非常簡(jiǎn)單的一種布局方式,它會(huì)以同樣大小對(duì)父組件中的子組件進(jìn)行布局,這些子組件將以一行或一列的形式排列。一般來(lái)說(shuō),用戶可以在任務(wù)欄、工具欄中放置FillLayout布局,通過FillLayout布局對(duì)子組件進(jìn)行定位,也可以當(dāng)子組件只有一個(gè)組件時(shí),通過FillLayout布局填充整個(gè)父組件的空間。

FillLayout的風(fēng)格

FillLayout布局中,可以把子組件按水平或垂直的方式進(jìn)行排列,這些風(fēng)格是當(dāng)創(chuàng)建FillLayout實(shí)類時(shí)以參數(shù)形式指定的。

演示代碼:
復(fù)制代碼 代碼如下:

package swt_jface.demo2;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class FillLayoutSample {

Display display = new Display();
Shell shell = new Shell(display);
public FillLayoutSample() {

FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
fillLayout.marginHeight = 5;
fillLayout.marginWidth = 5;
fillLayout.spacing = 1;

shell.setLayout(fillLayout);

Button button1 = new Button(shell, SWT.PUSH);
button1.setText("button1");

Button button2 = new Button(shell, SWT.PUSH);
button2.setText("button number 2");

Button button3 = new Button(shell, SWT.PUSH);
button3.setText("3");
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}

public static void main(String[] args) {
new FillLayoutSample();
}
}

相關(guān)文章

最新評(píng)論