The following is close to what I want and does what I expect:
import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import net.miginfocom.swing.MigLayout; public class MigBug extends JFrame { public static void main(String args[]) { MigBug migbug = new MigBug(); migbug.pack(); migbug.setVisible(true); } public MigBug() { JPanel content = new JPanel(); content.setLayout(new MigLayout("fill, debug")); content.add(new JLabel("Label 1")); content.add(new JComboBox()); content.add(new JLabel("Label 2")); content.add(new JTextField(25), "growx, wrap"); content.add(new JLabel("BIG"), "span, w :400:, h :200:, growy"); setContentPane(content); } }
However, if I make the following change:
content.add(new JLabel("BIG"), "span, w :400:, h :200:, grow");
t. Change the stretched component to grow on both x and y, the core of label 1 grows at x, although it should not.
Does anyone know how I can get around this?
source share