Java Gridlayout: variable column count depending on Panel width

229 views Asked by At

I have a Java Application with a Panel inside a Scrollview. The Panels Layout is a Gridlayout, and it has multiple Checkboxes.

Example:

Checkbox01 Checkbox02 Checkbox03 Checkbox04

Checkbox05 Checkbox06 Checkbox07 Checkbox08

Checkbox09 Checkbox10 Checkbox11 Checkbox12

When i resize the Panel, i want to increase/decrease the Columncount of the Gridlayout depending on the width of the Panel, so that the width of the Checkboxes stays the same. How can i do this?

1

There are 1 answers

0
user3292244 On BEST ANSWER

Answer to my own Question: Just use FlowLayout instead of Gridlayout.. It does exactly what i want