Vaadin panel is shown although set to invisible

Hi,

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

[code]
Panel mainPanel = new Panel(“MainPanel”);
HorizontalLayout panelContent = new HorizontalLayout();
panelContent.setSpacing(true);
panelContent.setMargin(true);
panelContent.setWidth(“100%”);

Label description = new Label(“description”);
panelContent.addComponent(description);
panelContent.setVisible(false);
mainPanel.addClickListener(e → mainPanel.setVisible(!mainPanel.isVisible());
mainPanel.setContent(panelContent);
[/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 (http://stackoverflow.com/questions/38049049/vaadin-panel-is-shown-although-set-to-invisible) - as someone suggested, this might be a bug in the layout, I decided to post this also here

Hello,

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 ?

Regards

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