How to reduce composite size within the ScrolledComposite in swt?

六眼飞鱼酱① 提交于 2019-12-25 03:24:57

问题


I am struggling to reduce the size of components within the scrolled composite. The problem is , always components(Tableviewer) getting bigger size.Unable to reduce the size.i tried setSize method of components .But no effect

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));
}

Please help me how to reduce the size whenver minimize and maximize the size of the form? Tableviewer1 and al tables couldnt reduce size. :-(

来源:https://stackoverflow.com/questions/25550955/how-to-reduce-composite-size-within-the-scrolledcomposite-in-swt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!