How do I make a view scrollable in an Eclipse RCP application?(如何在 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?
推荐答案
ScrolledComposite的Javadoc描述了两种使用方式,包括示例代码.总结一下:
The Javadoc of ScrolledComposite describes the two ways to use it, including example code. To sum them up:
- 您可以在控件/复合体本身上设置
ScrolledComposite
中包含的控件/复合体的大小 - 或者您告诉
ScrolledComposite
用于其内容的最小尺寸.
- 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 应用程序中使视图可滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Eclipse RCP 应用程序中使视图可滚动?


- Jersey REST 客户端:发布多部分数据 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01