gpt4 book ai didi

java - ScrolledComposite 在设置为展开时不显示滚动条

转载 作者:搜寻专家 更新时间:2023-11-01 02:47:00 26 4
gpt4 key购买 nike

我的问题是,如果我的 Scrolled Composite 有

scrolledWrapper.setExpandHorizontal(true);
scrolledWrapper.setExpandVertical(true);

它在整个 ViewPart 上正确展开,但如果我缩小 View,则不会出现滚动条。

如果我不设置展开,滚动条会出现,但滚动复合内的整个复合不会展开。

    GridLayout gridLayout = new GridLayout(1, true);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, false);

ScrolledComposite scrolledWrapper = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrolledWrapper.setLayout(gridLayout);
// if set the scrollbars dont appear but the composite expand on the whole view
scrolledWrapper.setExpandHorizontal(true);
scrolledWrapper.setExpandVertical(true);

scrolledWrapper.setLayoutData(gridData);
scrolledWrapper.setBackground(Display.getCurrent().getSystemColor(BG_COLOR));

有人知道如何将 Composite 设置为扩展到我的整个 View ,同时在 View 缩小时显示滚动条吗?

最佳答案

我找到了一个解决方案:

您需要设置最小尺寸。复合 Material 需要知道在哪个尺寸下它会太小

scrolledWrapper.setMinSize(wrapper.computeSize(SWT.DEFAULT, SWT.DEFAULT));

关于java - ScrolledComposite 在设置为展开时不显示滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19831697/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com