# Java Notes

# Empty space: Borders and Gaps

## Add borders and gaps for a more attractive layout

The following dialog has a crowded, unpleasant look.

Adding a border around the content pane and gaps between the components gives it a much nicer appearance.

## When to use outer borders

- Windows without borders. Windows with large areas for display (eg, a browser), or large working areas (eg, IDE, word processor, photo editor) typically have no window borders because the user wants to be able to use the as much of the screen space as possible.
- Windows with borders. Windows that are unlikely to be maximized typically have a border. Components which are directly against the edge of a window often produce an uncomfortable feeling. Dialog boxes almost always use borders. The size of a border typically is 10-12 pixels.

## How to set a window border