我在BoxLayout
组中有四个按钮。这只是两个示例,因为它是全部重复的代码。我想在每个按钮之间创建一个小空间,这样它们就不会碰到对方。我已经尝试了几乎所有的方法在.add(Box.Create....)
,没有任何工作。如何在boxLayout中的两个按钮之间添加空格?
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());
哦!我没有意识到你可以做到这一点。 – Susie
很高兴帮助。您也可以访问您的[早期问题](http://stackoverflow.com/users/998505/susie?tab=questions)以查看是否有可以标记为“正确”的答案。 –