Layouting: Consume rest of space


Maybe I’ve misunderstood the Book Of Vaadin and I hope someone may clarify.

Let’s take the button example of the buttons being laid out and sized using setExpandRatio:

Assuming I have only two components (being layouts to be concrete), and I would like to size them as follows:

  • First button takes just as much space required to be displayed without cropping (basically as big as the label plus some little extra for the border)
  • The second button takes up all the rest of the space
  • Both buttons together (the layout which they are in) take up 100% of the width.

I’ve used the
but this results in strange behaviour.

And is it the right way to set the expand ratio for the first button to 0.0f and the second to 1.0f?
For those who know Swing: I’d like a similar behaviour to the properties “weightx” and “weighty” of the GridBagLayout in Swing. More about this:
middle of the page, just above the title “The Example Explained”.

Many thanks for any tips and

best regards

That should be easy to do.

  1. component: Width: undefined (-1)
  2. component: Width: 100%

…or did you try this already?