I was looking for the following behavior in a JPanel (Swing) layout: basically it will compose the components vertically, one below each other.
When the components cannot fit vertically in the container, it must add the next to a new line. This will continue dynamically, adding new lines as needed.
It would seem like this by adding 3 tags:
+--------------------------+ | label1 | | label2 | | label3 | +--------------------------+
After adding: 2 more shortcuts:
+--------------------------+ | label1 label4 | | label2 label5 | | label3 | +--------------------------+
Finally, after adding two more labels, it will look like this:
+--------------------------+ | label1 label4 label7 | | label2 label5 | | label3 label6 | +--------------------------+
Is it possible to achieve this behavior using one of the current layouts?
Should I create it myself?
How would you decide this decision?
source share