Fill Entire Cell With Two Components Using MigLayout
I have two components which I would like to both fill the same cell in a MigLayout:
For example, I want to give both components constraints something like this:
cell 0 0 1 1, push, grow
and have them both be placed exactly over top of one another inside cell 0 0
(If I just use the code above, they end up sharing space side-by-side in the cell)
What do I have to add to the MigLayout constraints to make this happen?
I ended up solving the issue by giving the first component an id in MigLayout:
cell 0 0 1 1, push, grow, id myid
Then explicitly positioned the second component on top of the first using the first component's bounds (referenced using the id):
pos myid.x myid.y myid.x2 myid.y2
Place them in a panel with CardLayout and swap when necessary.