Absolute positioning corrupts sizing of grid components
In several places in our application we use absolute positioning to tweak the location of a component. Since upgrading to MigLayout 4.2, we have noticed that these layouts are all broken; specifically, some components in the grid are not getting the correct size. If we don't add the absolutely positioned component to the layout, all components are sized correctly.
When this happens, if you do something that triggers a revalidate like re-size the containing window, the layout seems to recalculate and then gets the sizes right. I have included a simple class that demonstrates.
It is my understanding that grid layout and absolute positioning are meant to be used together without any problems. Is this a bug, and if so can you recommend a workaround? I took a quick look at the source but could not easily find the problem. Any advice on how to correct this would be much appreciated.
public class MigBugTest extends JPanel
setLayout(new MigLayout("insets dialog"));
JButton button = new JButton("Button");
//If you comment this out, the text area will size correctly.
add(button, "pos n text.y text.x2 n");
* This text area should grow horizontally and vertically, but it won't
* as long as the button is included, unless you resize the frame to
* force a re-layout.
JTextArea text = new JTextArea("Some text");
add(text, "id text, push, grow");
public static void main(String args)
JFrame frame = new JFrame("Test");
frame.setSize(new Dimension(300, 300));