Search code examples
javavaadinsplitpanel

Can't add components in VerticalSplitPanel


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?


Solution

  • Try to set panel height first. It will work but I'm not sure why.

    The default layout of Panel is VerticalLayout with undefined height. It's strange, because I thought If you insert enough components in such a layout, it will grow.