Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

setWidth() and setSizeFull() on components has no effect.

Herberts Markūns
6 years ago Feb 02, 2016 2:47pm
Johannes Häyry
6 years ago Feb 02, 2016 8:18pm
Herberts Markūns
6 years ago Feb 03, 2016 6:44am
Peter Hansson
6 years ago Feb 08, 2016 6:25pm

If it makes you feel any better I too struggle with this ... constantly !

I've read the relevant parts of the Book of Vaadin over and over again. It's like it works sometimes and sometimes not.

Herberts Markūns
6 years ago Feb 08, 2016 6:40pm
Carlos Conti
6 years ago Feb 08, 2016 7:42pm

Well I don't know the component tree you are building but in your code you are not sizing 'myCustomComponent' which without anyother information I have to presume it is undefined. If Undefined, it will display inside the panel using the minimum space necessary. Setting the VerticalLayout and HorizontalLayout size inside myCustomComponent is also necessary, but myCustomComponent must have set its size too.

If you set 100% width, it should stretch to get all available Panel's space. The inner Vertical and HorizontalLayout's will expand to ocupy all space available from myCustomComponent, since they have their size settled from what you said.

I also struggled a while with that issue, but once understood it is certainly easy. Checking with a new app, doing some tests and analyzing the output html helps a lot.

Give it a try. Good luck.
Regards,
Carlos.

 

Herberts Markūns
6 years ago Feb 16, 2016 8:41am