我很难在tabfolder中获取可滚动区域....不知道我哪里出错...如果我得到一些帮助就会很棒......
public void createCustomControl(Composite parent)
{
parent.setLayout(new GridLayout());
tabFolder = new TabFolder(parent, SWT.H_SCROLL |SWT.V_SCROLL);
ScrolledComposite scroll = new ScrolledComposite(tabFolder, SWT.V_SCROLL|SWT.H_SCROLL);
scroll.setExpandHorizontal(true);
scroll.setExpandVertical(true);
GridData scrolledData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL
| GridData.GRAB_VERTICAL);
scroll.setLayoutData(scrolledData);
Composite result = new Composite(scroll, SWT.NONE);
GridData resultData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL
| GridData.GRAB_VERTICAL);
result.setLayoutData(resultData);
scroll.setContent(result);
scroll.setMinSize(scroll.computeSize(SWT.DEFAULT, SWT.DEFAULT));
tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
答案 0 :(得分:0)
您需要创建TabItem
并通过调用ScrolledComposite
为其分配setControl()
。选项卡文件夹仅在将子项分配给选项卡项时显示子项。
在代码末尾添加以下行:
final TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setControl(scroll);