There are three different kinds of panel each spanning different number of grids. 1*3 , 1*1 , 3*1 .
add(panel1, "span 1 3,push, grow");
add(panel2, "push, grow");
add(panel3, "span 3 1,push, grow");
I want to change first panel’s constraint to “span 1 2” when it overlaps with other panel on the screen. But to find out whether it overlaps with another panel I have to know it’s bounds.
I did not set any size constraints.
Is there any way , to know ‘the bounds before the panel/component is actually displayed’?
And also, how to know the length of the rows and columns set by the MigLayout manager?
Actually I want to cover the full screen with these differently sized panels.
EDIT :
I forgot to enter the main culprit …add(lastPanel, span, push, grow)
I am trying to cover the full screen with differently sized panels. This code works for even number of rectangles but not for odd. When they are odd in number, then the last grid is always left empty . So I spanned the last panel to cover the full empty available space, but then it overlapped with the 3*1 panel.
I got this similar problem again but this time I got the answer, I might be helpful for someone, so I am posting it here.
I wanted the dimensions set by the LayoutManager at compile time (which was not possibe). The AncestorListener did the trick, as soon as the components were laid out on the screen . It captures the dimensions and modified the components accordingly.