Java mig布局-跨度和增长/推进间距
我想要3个组件布置在2行上,以便底部组件和右上组件使用所有可用的水平空间Java mig布局-跨度和增长/推进间距,java,swing,miglayout,Java,Swing,Miglayout,我想要3个组件布置在2行上,以便底部组件和右上组件使用所有可用的水平空间 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"
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);
考虑到上述情况,如何在调整帧大小时阻止“组件1”和“组件2”之间出现空格
cp.add(new JTextField("component 1"), "");
cp.add(new JTextField("component 2"), "growx,push,wrap");
cp.add(new JTextField("component 3"), "span,growx,pushy");
解决了这个问题