非常简单的问题:如何消除包含两者的两个单元格之间的垂直间隙JCheckBox
?我用红色边框标记了图片中的空白。
这是代码:
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
public class Main {
public static void main(String[] args) {
JPanel somePanel = new JPanel();
somePanel.setLayout(new MigLayout("insets 0, debug", "", ""));
somePanel.add(new JCheckBox("first option"), "h 20!");
somePanel.add(new JButton("click me"), "spany 2, h 40!, w 60%, wrap");
somePanel.add(new JCheckBox("option two"), "h 20!");
JFrame frame = new JFrame();
frame.setContentPane(somePanel);
frame.pack();
frame.setVisible(true);
}
}