本文介绍了如何使视图在Eclipse RCP应用程序中滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我到目前为止所尝试的:
What I tried so far:
在createPartControl中:
In createPartControl:
ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
sc.setLayoutData(new GridData(GridData.FILL_BOTH));
sc.setExpandVertical(true);
sc.setExpandHorizontal(true);
sc.setSize(ApplicationWorkbenchWindowAdvisor.WIDTH, ApplicationWorkbenchWindowAdvisor.HEIGHT);
final TabFolder tabFolder = new TabFolder(sc, SWT.TOP);
但这不行。我的问题是如果我调整我的程序窗口大小,滚动条不会出现在我的视图中。任何想法?
but this does not work. My problem is that if I resize my program window the scrollbars does not appear in my view. Any ideas?
推荐答案
描述了使用它的两种方法,包括示例代码。总结起来:
The Javadoc of ScrolledComposite describes the two ways to use it, including example code. To sum them up:
- 您可以设置
ScrolledComposite $中包含的控件/复合物的大小c $ c>控件/复合本身
- 或者你告诉你的
ScrolledComposite
最小尺寸用于其内容。 li>
- You either set the size of the control/composite contained in your
ScrolledComposite
on the control/composite itself - Or you tell your
ScrolledComposite
the minimum size to use for its content.
目前,你们都没有。您在 ScrolledComposite
中设置大小,但除非您不使用布局管理器,这并不太有意义。无论如何,请参阅上述链接以查看某些官方示例代码。
Currently, you're doing neither. You're setting the size on the ScrolledComposite
, but unless you don't use a layout manager, that doesn't make much sense. In any case, see the above link for some official example code.
这篇关于如何使视图在Eclipse RCP应用程序中滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!