java如何在JPanel上放置expandbar?
有没有一种方法可以将expandbar添加到jframe或jpanel上,而无需使用代码(使用已创建的组件)创建每个组件
以下是我使用的代码:(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);
我曾尝试将expandbar添加到面板中,并尝试将显示屏和外壳添加到面板中,但没有成功
请帮忙。 谢谢
# 1 楼答案
根据我在网上看到的示例,您的代码相当不完整。我对
SWT
了解不多,但ExpandBar
它不是Component
或Container
的子类,因此它们不能添加到Panel
或Frame
中找到了一个很好的例子here
我测试了一下,效果很好
可以在here找到
ExpandBar
文档