如何在swt中的ScrolledComposite中减少复合尺寸?

时间:2014-08-28 14:11:27

标签: java swt jface

我正在努力减少滚动复合材料中组件的大小。 问题是,总是组件(Tableviewer)变得更大。无法减小size.i尝试了组件的setSize方法。但没有效果

public void createForm(final Form form, final FormToolkit toolkit) {
    parent = toolkit.createComposite(form.getBody());
    GridLayout singleCol = new GridLayout(1, true);
    canvas.setLayout(singleCol);

    GridData fillData = new GridData(SWT.FILL, SWT.FILL, true, true);
    // fillData.widthHint = 10;
    parent.setLayoutData(fillData);
    textArea = new DescriptionSection(this, parent, toolkit);


    ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);

    columns = toolkit.createComposite(sc);
    columns.setLayout(new GridLayout(2, true));
    columns.setLayoutData(fillData);

    left = toolkit.createComposite(columns);
    left.setLayout(singleCol);
    left.setLayoutData(fillData);

    right = toolkit.createComposite(columns);
    right.setLayout(singleCol);
    right.setLayoutData(fillData);

    tableViewerSection1 = new TableViewerSection1(this, left, toolkit);
    tableViewerSection2 = new tableViewerSection2(this, left, toolkit);
    tableViewerSection3 = new tableViewerSection3(this, left, toolkit);
    tableViewerSection4 = new TableViewerSection4(this, right, toolkit);
    tableViewerSection5 = new TableViewerSection5(this, right, toolkit);
    tableViewerSection6 = new TableViewerSection6(this, right, toolkit);

    sc.setContent(columns);        
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.setMinSize(columns.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}

如果最小化并最大化表单大小,请帮助我如何减小尺寸? Tableviewer1和al表无法减小大小。 : - (

enter image description here

0 个答案:

没有答案