Home > database >  Java Swing FlowLayout in Vaadin
Java Swing FlowLayout in Vaadin

Time:05-09

As some of you might know there is a Layout that is called FlowLayout in the Java Swing Framework. To spice things up a little I started using Vaadin instead of Swing. Everything works fine except that I haven't found an easy alternative to the classic Swing FlowLayout.

I want to place Components next to each other until the horizontal space of a row is filled and the layout starts placing components in a new row. I tried using the Horizontal Layout, but instead of creating a new row, it makes its components smaller.

Any Ideas?

CodePudding user response:

You can use a FlexLayout with wrapping. The default direction (column) and a wrap will give you the behaviour, that items added to the layout will use the space they need (make sure to "un-specifiy" where needed) and once the horizontal screen space is used up, break into the next line.

  • Related