?? formattachment1.java
字號(hào):
package cn.com.chengang.swt;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class FormAttachment1 {
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(327, 253);
// ---------創(chuàng)建窗口中的其他界面組件-------------
shell.setLayout(new FormLayout());
Button button = new Button(shell, SWT.NONE);
button.setText("button");
FormData formData = new FormData();
// 按鈕的頂端(formData.top)離shell容器的空白邊距是shell容器總體空白長(zhǎng)度的60%
formData.top = new FormAttachment(60, 0);
button.setLayoutData(formData);
// -----------------END------------------------
shell.layout();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -