Search code examples
javaswinglayout-managerjcheckbox

float checkboxes on expand in Swing


I've made a simple GUI with 2 lines of checkboxes. The checkboxes are all the same size. When I maximize the application, they are anchored on the left so it looks a bit out of place.

I would like to have the checkboxes slowly move to the first line if there is space. Similar to the way 'float' works in CSS (on websites).

Does Swing have this type of functionality?


Solution

  • Check out Wrap Layout which works in many cases.