ScrolledComposite parent with GridLayout

I'd like to have a `ScrolledComposite` which has a parent with `GridLayout` but the scrollbar doesn't show up, unless I use `FillLayout`. My problem with `FillLayout` is that its children takes equal parts of the available space. In my case there are two widgets, the one on top should take not more than 1/4 of the window and the `ScrolledComposite` should take the remainder space. However, both of them take half of it. Is there a way to use a `GridLayout` with `ScrolledComposite` or is it possible to modify the behaviour of `FillLayout`? Here's my code: private void initContent() { //GridLayout shellLayout = new GridLayout(); //shellLayout.numColumns = 1; //shellLayout.verticalSpacing = 10; //shell.setLayout(shellLayout); shell.setLayout(new FillLayout(SWT.VERTICAL)); searchComposite = new SearchComposite(shell, SWT.NONE); searchComposite.getSearchButton().addListener(SWT.Selection, this); ScrolledComposite scroll = new ScrolledComposite(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); scroll.setLayout(new GridLayout(1, true)); Composite scrollContent = new Composite(scroll, SWT.NONE); scrollContent.setLayout(new GridLayout(1, true)); for (ChangeDescription description : getChanges(false)) { ChangesComposite cc = new ChangesComposite(scrollContent, description); } scroll.setMinSize(scrollContent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scroll.setContent(scrollContent); scroll.setExpandVertical(true); scroll.setExpandHorizontal(true); scroll.setAlwaysShowScrollBars(true); }

以上就是ScrolledComposite parent with GridLayout的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏