I have four buttons in a BoxLayout group. This is just a sample of two because it’s all repeated code. I want to create a slight space between each button so they don’t run into each other. I have tried practically every method in the .add(Box.Create....) and nothing worked.
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());
If you want to have space between components, you can either add an empty border to one or both components, or insert invisible components to provide the space. You can create invisible components with the help of the Box class.
since you already used glue with no success (I doubt why?), you may try something like Rigid area,
Have a look at Using Invisible Components as Filler which gives you a lot of options and explanations.
ADDITIONAL INFORMATION, From Putting Space Between Components,
Three factors influence the amount of space between visible components in a container:
The layout manager
Invisible components
Empty borders