Are there any recommendations regarding how many space controls in Swing should have around them? The question also arises of how to achieve this: some layout managers support gaps between controls; some of them do not use when you need to use EmptyBorder, which can also be painful, since the borders do not overlap, and you can get too much space between the two controls 1 - so you may need to leave one side of the border.
Another problem: Look and Feels: If I use explicit spaces or borders, this may look good in one LAF, but bad in another. For example, Nimbus looks great with buttons closely connected, as they have extra space around them. By default, Windows LAF simply populates them together without extra space. I understand that this is fundamentally a platform problem, because Microsoft, Apple, Gnome and others have different recommendations on this topic .
So, if I add extra space between the controls for placement on Windows or Metal LAF, it becomes too far apart in Nimbus and possibly with others.
Then the whole problem arises of how you create your user interface, which has serious side effects regarding how flexible you are with distances and borders. Putting just one container using is GridBagLayoutexcellent from this point of view, but terrible if you still need to make changes to the user interface. Then create a user interface from several JPanelwith the appropriate layout managers.
In short: how can I make sure the controls are well placed and suitable for LAF, without the hassle? Maybe I'm just overlooking something here - with a huge Swing size, which is unlikely.
1 , - , . , , - , . , , ( , , , , , ).