?? griddata1.java
字號:
package cn.com.chengang.swt;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class GridData1 {
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(327, 253);
// ---------創建窗口中的其他界面組件-------------
shell.setLayout(new GridLayout(2, false));
new Button(shell, SWT.NONE).setText("b1");
new Button(shell, SWT.NONE).setText("button2");
// 定義一個GridData對象,讓b3按鈕搶占兩列的空間
Button b3 = new Button(shell, SWT.NONE);
GridData gridData = new GridData();
// GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
b3.setLayoutData(gridData);
b3.setText("b3");
new Button(shell, SWT.NONE).setText("button4");
new Button(shell, SWT.NONE).setText("button5");
// Button button5 = new Button(shell, SWT.NONE);
// GridData gridData2 = new GridData(GridData.FILL_HORIZONTAL);
// button5.setLayoutData(gridData2);
// button5.setText("button5");
// -----------------END------------------------
shell.layout();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -