Mig layout - span and increment / distance between clicks

I want the 3 components to be laid out on 2 lines so that the bottom component and the top right component use all available horizontal spaces.

JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setLayout(new MigLayout("debug, fill"));
Container cp = frame.getContentPane();
cp.add(new JTextField("component 1"), "");
cp.add(new JTextField("component 2"), "growx,push,wrap");
cp.add(new JTextField("component 3"), "span,growx,push");
frame.pack();
frame.setVisible(true);

      

Given the above, how can I stop the space between "component 1" and "component 2" when popping up when resizing the frame?

space problem example

+2


a source to share


1 answer


cp.add(new JTextField("component 1"), "");
cp.add(new JTextField("component 2"), "growx,push,wrap");
cp.add(new JTextField("component 3"), "span,growx,pushy");

      



solves this case.

+5


a source







All Articles