2
我想配置像這樣的對話窗口:horizontalSpan在SWT GridLayout中不跨越
@Override
protected Control createDialogArea(Composite parent) {
GridLayout dialogAreaLayout = new GridLayout();
dialogAreaLayout.numColumns = 2;
parent.setLayout(dialogAreaLayout);
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
gridData.minimumWidth = 300;
// the label in the first row should span across both columns
gridData.horizontalSpan = 2;
Label headlineLabel = new Label(parent, SWT.NONE);
headlineLabel.setText("example test");
headlineLabel.setLayoutData(gridData);
// the rest should be ordered in two columns
gridData.horizontalSpan = 1;
companyLabel = new Label(parent, SWT.NONE);
companyLabel("company");
companyTextfield = new Text(parent, SWT.BORDER);
companyTextfield(gridData);
...
我試圖做到的是一個標籤在第一橫跨兩列,並且每行對成對地排列以下字段。我得到的結果是,標籤(應該留在第二行)在第一行是正確的,就像標籤不會跨越兩列一樣。任何人都可以看到,我做錯了什麼?
再次感謝!
其實這是可能的,但不推薦。但耶:不要這樣做:D – Baz
一個突然,魔術作品8) –