简体   繁体   English

如何跨越gridLayout的2列?

[英]How to span 2 column of gridLayout?

I want to span right 2 column of 3 column in grid layout, but I do not know how to do, someone can give me some guidance on how to do ?我想在网格布局中跨越 3 列中的 2 列,但我不知道该怎么做,有人可以给我一些指导吗?

Example code and image is below:示例代码和图像如下:

@PostConstruct
    public void PostConstruct(Composite parent) {

        toolkit = new FormToolkit(Display.getDefault());
        form = new ScrolledForm(parent, SWT.V_SCROLL);
        form.setBounds(0, 0, 650, 478);
        form.setExpandHorizontal(true);
        form.setExpandVertical(true);
        form.setBackground(toolkit.getColors().getBackground());
        form.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
        form.setFont(JFaceResources.getHeaderFont());
        form.setText("DOCUMENTATIONS");
        toolkit.decorateFormHeading(form.getForm());
        GridLayout cl = new GridLayout(3, true);
        form.getBody().setLayout(cl);

        sectionSelection = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
        sectionSelection.setText("");
        sectionClientSelection = toolkit.createComposite(sectionSelection);

        sectionClientSelection.setLayout(new GridLayout());
        sectionClientSelection.setLayoutData(new GridData(100, 100));
        sectionSelection.setClient(sectionClientSelection);

        createSelectionSection();

        sectionDefinition = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
        sectionDefinition.setText("");
        sectionClientDefinition = toolkit.createComposite(sectionDefinition);

        sectionClientDefinition.setLayout(new GridLayout());
        GridData gridData = new GridData(SWT.FILL,GridData.VERTICAL_ALIGN_END);
        gridData.horizontalSpan = 2;
        gridData.horizontalAlignment = GridData.FILL;
        sectionClientDefinition.setLayoutData(gridData);
        sectionDefinition.setClient(sectionClientDefinition);

        createDefinitionSection();

    }

在此处输入图片说明

您需要为该部分而不是该部分中的复合设置布局数据。

sectionDefinition.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM