我想在复合材料上显示标签。我添加了标签,但我看不到显示。我的代码如下:
GridLayout parentLayout = new GridLayout(1, true);
parent.setLayout(parentLayout);
Composite filterComposite = new Composite(parent, SWT.NONE);
GridData filterCompositeData = new GridData();
filterCompositeData.verticalAlignment = GridData.FILL;
filterCompositeData.horizontalSpan = 2;
filterCompositeData.grabExcessHorizontalSpace = true;
filterCompositeData.grabExcessVerticalSpace = true;
filterCompositeData.horizontalAlignment = GridData.FILL;
filterComposite.setLayoutData(filterCompositeData);
Label l1 = new Label(filterComposite, SWT.NONE);
Text t1 = new Text(filterComposite, SWT.NONE);
l1.setText("xxxxxxxxxxx");
有人能告诉我这样做的方法吗?
答案 0 :(得分:1)
您尚未在filterComposite
上设置布局 - 您必须在每个Composite
上设置布局