我在一个BoxLayout
组中有四个按钮。这只是两个示例,因为它都是重复的代码。我想在每个按钮之间创建一个微小的空间,这样它们就不会相互碰撞。我几乎尝试了所有方法,但.add(Box.Create....)
没有任何效果。
enter.add(Box.createVerticalGlue());
enter.add(Box.createHorizontalGlue());
//enter.add(new JSeparator(SwingConstants.HORIZONTAL));
JButton float = new JButton("LOWER");
float.add(Box.createVerticalGlue());
float.add(Box.createHorizontalGlue());