2017-08-21 6 views
0

grpModelPropertiesの高さを低くしたい。グループ内のテキストボックスの上下の距離を同じにするにはどうすればよいですか?SWT:グループの高さ

public void createControl(Composite parent) { 

    Composite composite = new Composite(parent, SWT.NULL); 
    composite.setLayout(new FillLayout()); 

    Group grpModelProperties = new Group(composite, SWT.SHADOW_IN); 
    grpModelProperties.setText("ETL Transformation Model"); 
    grpModelProperties.setLayout(new GridLayout(2, false)); 


    GridData data = new GridData(GridData.FILL_HORIZONTAL); 
    text = new Text(grpModelProperties, SWT.NONE); 
    text.setLayoutData(data); 

    Button button = new Button(grpModelProperties, SWT.PUSH); 
    button.setText("File System..."); 
    button.addSelectionListener(new SelectionAdapter() { 
    public void widgetSelected(SelectionEvent e) { 
    FileDialog dialog = new FileDialog(getShell(), SWT.NULL); 
    String path = dialog.open(); 

    if (path != null) { 
    File file = new File(path); 
    if (file.isFile()) 
     displayFiles(new String[] { file.toString()}); 
     else 
     displayFiles(file.list()); 

    } 
} 

答えて

3

あなたはそのグループがダイアログ領域を埋めるように引き伸ばされているGroupを含むCompositeためFillLayoutを指定しました。私はGridLayoutを使用している。ここで

Composite composite = new Composite(parent, SWT.NULL); 
composite.setLayout(new GridLayout()); 

Group grpModelProperties = new Group(composite, SWT.SHADOW_IN); 
grpModelProperties.setText("ETL Transformation Model"); 
grpModelProperties.setLayout(new GridLayout(2, false)); 

// Layout data for the group in the composite, 
// Fill the row, stays at the top of the dialog 
grpModelProperties.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); 

だけ行を埋めるためにグループのためGridDataを設定:

複合ために異なるレイアウトを使用します。

関連する問題