我有一個讓SWT文本控件按照我希望它們在組內的方式出現問題。具體而言,我很難將傳遞到GridData
的verticalSpan
反映在GUI資產中。在下面的示例中,我無法正確顯示的3個控件是descriptionText
,defaultActionText
和defaultReportActionText
,但translationText
顯示屏正確顯示。我不確定我在這裏做錯了什麼,所以我很感激任何反饋!在一個組中排列SWT文本控件的困難
組:
paramsFieldComposite = new Group(upperRightComposite, SWT.BORDER);
// TODO: Change group to composite and remove .setText()
paramsFieldComposite.setText("paramsFieldComposite");
paramsFieldComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
paramsFieldComposite.setLayout(new GridLayout(2, true));
翻譯控制(工作,我會爲1的寬度和高度3預計):
Label hostnameLabel = new Label(paramsFieldComposite, SWT.NONE);
hostnameLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
hostnameLabel.setText(configResourceBundle.geti18nDisplay("HostnameLabel"));
Label translationLabel = new Label(paramsFieldComposite, SWT.NONE);
translationLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
translationLabel.setText(configResourceBundle.geti18nDisplay("TranslationLabel"));
hostnameText = new TextControl(paramsFieldComposite, SWT.BORDER);
hostnameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
hostnameText.setEditable(true);
translationText = new TextControl(paramsFieldComposite, SWT.BORDER | SWT.V_SCROLL | SWT.WRAP);
translationText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 3));
translationText.setEditable(true);
說明/動作控制(不工作爲我期待,我希望他們都有3而不是1的高度):
Label descriptionLabel = new Label(paramsFieldComposite, SWT.NONE);
descriptionLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
descriptionLabel.setText(configResourceBundle.geti18nDisplay("DescriptionLabel"));
descriptionText = new TextControl(paramsFieldComposite, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
descriptionText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 3));
descriptionText.setEditable(true);
Label defaultActionLabel = new Label(paramsFieldComposite, SWT.NONE);
defaultActionLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
defaultActionLabel.setText(configResourceBundle.geti18nDisplay("DefaultActionLabel"));
Label defaultReportActionLabel = new Label(paramsFieldComposite, SWT.NONE);
defaultReportActionLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
defaultReportActionLabel.setText(configResourceBundle.geti18nDisplay("DefaultReportActionLabel"));
defaultActionText = new TextControl(paramsFieldComposite, SWT.BORDER | SWT.V_SCROLL);
defaultActionText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 3));
defaultActionText.setEditable(true);
defaultReportActionText = new TextControl(paramsFieldComposite, SWT.BORDER | SWT.V_SCROLL);
defaultReportActionText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 3));
defaultReportActionText.setEditable(true);
這是GUI的外觀喜歡。
謹慎解釋downvote? – Baz