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.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Label grap free space Problem
Hello,
i need help...
At first i will describe you my layout:
In a Vertical Layout i have a head and a another Horizontal Layout. In this Horizontal Layout i will build a Label with a text and carrige returns and so on. And the second item in the layout is a image.
My Problem is that the label don´t grap the whole space beetween the image and the text or if i set no ComponentAlignment, the image is nearly right on the text and i have a big white frame on the right side.
To understand it i had made a screenshot:
The light grey lines should show how my layout works.
To fix the problem i test to setSizeUndefined or setWidth but i didn´t found a solution.
I hope u can help me.
Swoop
I haven't tried, but I think the following should work :
- The vertical and horizontal layouts should have setWidth(100, UNITS_PERCENT)
- Your label should have setWidth(100, UNITS_PERCENT)
- Your image setWidth(imageWidth, UNITS_PIXEL)
- then do horizontalLayout.setExpandRatio(label, 1.0f) to let the label stretch it's cell until it fills the whole space
See this chapter of the book for some explanation on expand ratio and component sizing.
Note : expand ratio is quite confusing at first, it is good to do some experiments with it in order to understand what is going on. Using firebug or webinspector to see what vaadin generated is also a life savior quite often.
Great it works!
All what i need was to add "horLayout.setExpandRatio(content, 1.0f);" =)
Many thanks for your help.
Swoop