在我的SWT應用程序中,我在SWT外殼中有特定的組件。我們如何自動調整SWT中組件的大小?
現在我怎麼能自動根據顯示窗口的大小重新調整這個組件的大小。
Display display = new Display();
Shell shell = new Shell(display);
Group outerGroup,lowerGroup;
Text text;
public test1() {
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns=1;
shell.setLayout(gridLayout);
outerGroup = new Group(shell, SWT.NONE);
GridData data = new GridData(1000,400);
data.verticalSpan = 2;
outerGroup.setLayoutData(data);
gridLayout = new GridLayout();
gridLayout.numColumns=2;
gridLayout.makeColumnsEqualWidth=true;
outerGroup.setLayout(gridLayout);
...
}
也就是說,當我減小窗口的大小時,它內部的組件應該按照那個出現。
您可以偵聽'SWT.Resize'事件並調用組件 – Alex