ed4becky
ed4becky

Reputation: 1630

MigLayout width - cell or Component?

I am not clear from the documentation - when I indicate a cell width

panel.add(cc,"width 100:200:300");

am I requesting a min:pref:max width for the cell or for the component in the cell?

Upvotes: 2

Views: 2053

Answers (1)

01es
01es

Reputation: 5410

From my experience it is best to enforce this kind of constraints at the layout level, which achieves a more consistent behaviour.

For example,

new MigLayout("insets 0", "[:50:][grow,fill,:50:250]20[:50:][grow,fill,:50:]", "[c]")`

where the second parameter sets the layout properties for columns (four columns in this case with specific preferred and maximum widths). Then components are added to the container with this layout manager by simply calling

panel.add(cc);

with or without the "wrap" option (which indicates the need to create a new row).

Upvotes: 2

Related Questions