Java 如何在swt中减少ScrolledComposite中的复合大小?

Java 如何在swt中减少ScrolledComposite中的复合大小?,java,swt,jface,Java,Swt,Jface,我正在努力减少滚动组合中组件的大小。 问题是,组件总是越大越稳定。无法减小大小。我尝试了组件的设置大小方法。但没有效果 public void createForm(final Form form, final FormToolkit toolkit) { parent = toolkit.createComposite(form.getBody()); GridLayout singleCol = new GridLayout(1, true); canvas.setL

我正在努力减少滚动组合中组件的大小。 问题是,组件总是越大越稳定。无法减小大小。我尝试了组件的设置大小方法。但没有效果

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表格无法缩小大小:-


请发布一个完整的例子,我们可以简单地复制/粘贴/运行。不是你的完整代码,只是一个显示你的问题的示例。嗨,我添加了代码和屏幕截图。你能帮我吗?你发布了更多代码很好,但我仍然不能简单地复制和粘贴它。例如,什么是TableViewer。您的方法是如何调用的?您好,这里的表查看器是ExtendedGridTableViewer。我们从中创建一个表名和冒号。我们将表格放入合成表格中…但在滚动或最大化表格时,表格的大小总是很大。