如何在JPanel上放一个扩展栏? [英] How to put an expandbar on a JPanel?

查看:146
本文介绍了如何在JPanel上放一个扩展栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在jframe或jpanel上添加一个扩展栏,而不用代码创建每个组件(使用已经创建的组件)。



这是代码我使用了:( http://www.eclipse.org/swt/snippets/#expandbar

 显示display = new Display(); 
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setText(ExpandBar Example);
ExpandBar bar = new ExpandBar(shell,SWT.V_SCROLL);

我已经尝试添加扩展栏到面板,以及尝试添加显示和shell到面板,但不起作用。



请帮忙。
谢谢

解决方案

您的代码相当不完整,基于我在线看到的示例。我不太了解 SWT ExpandBar 它不是子组件 code>或 Container ,因此无法将其添加到面板

发现一个很好的例子这里

我测试了它,它的工作原理。



ExpandBar 文档被找到这里


Is there a way to add a expandbar onto a jframe or jpanel without creating each component with code (using components that is already created).

Here is the code I used: ( http://www.eclipse.org/swt/snippets/#expandbar )

Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
shell.setText("ExpandBar Example");
ExpandBar bar = new ExpandBar (shell, SWT.V_SCROLL);

I have tried to add the expandbar to the panel, as well as trying to add the display and the shell to the panel, but does not work.

Please help. Thanks

解决方案

Your code is rather incomplete, basing on the example I saw online. I don't know much about SWT but ExpandBar its not a subclass of Component nor Container so they can't be added to a Panel or Frame.
Found a good example here.

I tested it and it works.

The ExpandBar documentation is found here

这篇关于如何在JPanel上放一个扩展栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆