SWT Text コントロールをグループ内で希望どおりにレイアウトするのに問題があります。具体的には、verticalSpan
渡されたGridData
を GUI アセットに反映させるのに苦労しています。以下の例では、正しく表示できない 3 つのコントロールはdescriptionText
、defaultActionText
、およびdefaultReportActionText
ですが、translationText
表示は正しく表示されます。ここで何が間違っているのかわからないので、フィードバックをいただければ幸いです。
グループ:
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 ) );
Translation Controls (幅 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 );
説明/アクション コントロール (期待どおりに機能しないため、すべての高さを 1 ではなく 3 にしたい):
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の外観は次のとおりです。