Vaadin panel is shown although set to invisible


I have a vaadin application (Vaading 7.6.6) and have the following code

Panel mainPanel = new Panel(“MainPanel”);
HorizontalLayout panelContent = new HorizontalLayout();

Label description = new Label(“description”);
mainPanel.addClickListener(e → mainPanel.setVisible(!mainPanel.isVisible());
[/code]this panel is added to a VerticalLayout and this is set as tab for a tab sheet.
My problem is the panels are visible, when the page is loaded.

when I click on one of them, its description is shown and the others are “collapsed” as expected.

(unfortunately the one with the label is cut in the image).

Why is the layout showing empty panels, when the page is loaded ? What do I must set, so that the page looks like the second image at the beginning ?

Thank you

PS: I also posted this on stackoverflow ( - as someone suggested, this might be a bug in the layout, I decided to post this also here


I don’t understand the piece of code you posted.
label will never be displayed as it’s in a layout (panelContent) that is set to visible=false, and the visible property is never updated.

May be you over-simplified the code you posted ?


In line 9 write:

mainPanel.setVisible(false); if your want the panel to be invisible and not the layout.

I over-simplified it indeed - didnt think that this would change the problem - sorry about that.

Actually I cannot reproduce this anymore - not sure what the problem was, or what it at the end let it disappear, but its gone.

Sorry for the confusion