1
我正在使用GridLayout
/GridData
構建UI。佈局假設有3個部分,一個是headingComposite
,一個是leftEditorComposite
,一個是rightEditorComposite
。但我的問題在於,我不希望我的leftEditorComposite
/rightEditorComposite
的寬度佈局被內容改變。 (如名稱文本框,如果輸入變長,那麼leftEdtiorComposite
的寬度也會變得更長。)有沒有辦法將它們作爲修正尺寸寬度?非常感謝!
GridLayout layout = new GridLayout(2, false);
mainComposite.setLayout(layout);
scrolledComposite.setContent(mainComposite);
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
data.horizontalSpan = 2;
headingComposite = new Composite(mainComposite, SWT.BORDER);
headingComposite.setBackground(getBackground());
headingComposite.setLayoutData(data);
data = new GridData(GridData.FILL_BOTH);
leftEditorComposite = new Composite(mainComposite, SWT.BORDER);
leftEditorComposite.setBackground(getBackground());
leftEditorComposite.setLayoutData(data);
data = new GridData(GridData.FILL_BOTH);
rightEditorComposite = new Composite(mainComposite, SWT.BORDER);
rightEditorComposite.setBackground(getBackground());
rightEditorComposite.setLayoutData(data);