无法在 VerticalSplitPanel 中添加组件
我正在使用 VAADIN 框架构建一个应用程序。
我正在尝试在包含 VerticalSplitPanel 的视图中添加一个面板,其中包含两个组件(目前是一个按钮和一个标签)。
非常简单,但我在完成它时遇到了很大的问题。
我可以确定发生了一些事情,因为当我在浏览器中运行它时,我看到“分割分隔符”显示,但分割面板内没有任何组件。
这就是我目前初始化面板的方式。
public class M2MInventory_SubscriptionsView extends AbstractView {
private Panel panel = new Panel();
private VerticalSplitPanel vSplit = new VerticalSplitPanel();
private Button upperButton = new Button("Upper Button");
private Button lowerButton = new Button("Lower Button");
public M2MInventory_SubscriptionsView() {
panel.setContent(vSplit);
vSplit.setFirstComponent(new Button("Upper"));
vSplit.setSecondComponent(new Label("Lower"));
addComponent(panel);
}
有人能发现我的方法有错误吗?
I am building an application using the VAADIN framework.
I am trying to add a panel in a view containing a VerticalSplitPanel which contains two components (a button and a label for the moment).
Pretty straight forward but I'm having big problems getting it done.
I can identify that something happens, because I see the "split-divider" show when I run it in a browser, but no components inside the split-panel.
This is how I initialize the panel for the moment.
public class M2MInventory_SubscriptionsView extends AbstractView {
private Panel panel = new Panel();
private VerticalSplitPanel vSplit = new VerticalSplitPanel();
private Button upperButton = new Button("Upper Button");
private Button lowerButton = new Button("Lower Button");
public M2MInventory_SubscriptionsView() {
panel.setContent(vSplit);
vSplit.setFirstComponent(new Button("Upper"));
vSplit.setSecondComponent(new Label("Lower"));
addComponent(panel);
}
Can anyone spot an error in my ways?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先尝试设置面板高度。它会起作用,但我不知道为什么。
Panel
的默认布局是VerticalLayout
,高度未定义。这很奇怪,因为我认为如果在这样的布局中插入足够的组件,它就会增长。Try to set panel height first. It will work but I'm not sure why.
The default layout of
Panel
isVerticalLayout
with undefined height. It's strange, because I thought If you insert enough components in such a layout, it will grow.