SWT(JFace)ÌåÑéÖ®FillLayout²¼¾Ö。本站提示廣大學習愛好者:(SWT(JFace)ÌåÑéÖ®FillLayout²¼¾Ö)文章只能為提供參考,不一定能成為您想要的結果。以下是SWT(JFace)ÌåÑéÖ®FillLayout²¼¾Ö正文
FillLayout²¼¾Ö
FillLayoutÊǷdz£¼òµ¥µÄÒ»ÖÖ²¼¾Ö·½Ê½£¬Ëü»áÒÔͬÑù´óС¶Ô¸¸×é¼þÖеÄ×Ó×é¼þ½øÐв¼¾Ö£¬ÕâЩ×Ó×é¼þ½«ÒÔÒ»ÐлòÒ»ÁеÄÐÎʽÅÅÁС£Ò»°ãÀ´Ëµ£¬Óû§¿ÉÒÔÔÚÈÎÎñÀ¸¡¢¹¤¾ßÀ¸ÖзÅÖÃFillLayout²¼¾Ö£¬Í¨¹ýFillLayout²¼¾Ö¶Ô×Ó×é¼þ½øÐж¨Î»£¬Ò²¿ÉÒÔµ±×Ó×é¼þÖ»ÓÐÒ»¸ö×é¼þʱ£¬Í¨¹ýFillLayout²¼¾ÖÌî³äÕû¸ö¸¸×é¼þµÄ¿Õ¼ä¡£
FillLayoutµÄ·ç¸ñ
FillLayout²¼¾ÖÖУ¬¿ÉÒÔ°Ñ×Ó×é¼þ°´Ë®Æ½»ò´¹Ö±µÄ·½Ê½½øÐÐÅÅÁУ¬ÕâЩ·ç¸ñÊǵ±´´½¨FillLayoutʵÀàʱÒÔ²ÎÊýÐÎʽָ¶¨µÄ¡£
ÑÝʾ´úÂ룺
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();
}
}