component auto adjust size

i have a HorizontalLayout component setWidth(“1000px”).

i just see a part of the HorizontalLayout component about 300px when i adjust the browser size and then refresh current page and then maximize the browser.

i want to let vaadin component auto adjust size when i change the browser size.how should i do?

:smiley:

why no one reply me? it is very important to me.looking for help…:smiley:

If I understand what you want, you need component.setSizeFull() so that it expands fully. You also need the container AROUND the component to be setSizeFull() if you want to use the full size of the browser – so you may need to do getWindow().getContent().setSizeFull() as well – all the containers all the way need to be setSizeFull().

You need to understand that setSizeUndefined() means “as small as possible” and setSizeFull() means “as large as possible”, and how setExpandRatio() allocates white space. The section in the Vaadin book on managing layout is worth reading over a few times (it does take a few times to make sense)

When things don’t inflate as you think, it is usually because you have forgotten about a layout that is set to a fixed size or that is acting as a rubber band (i.e. undefined).

wowwww! thank you very much!

i try to use your method:setSizeFull(),but i still can’t solve this problem,maybe you can understand my mean if you watch my screenshort

this image is before the refresh operate

this image is adjusting the browser size

this image display after refresh operate

it will back to first image when i refresh again.i don’t know how to solve this problem