Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com

Using BorderLayout you can tell components to stick to a side of a Container :

or occupy the remaining space :

The contentpane's layout mode is set to BorderLayout in the init method, telling it to leave 5 pixels of space between components horizontally and 10 vertically.

If you mistakenly add components without telling them where to go :
  add ( btn ) ,

only the last one added in this manner will be shown, taking up all space !

=========

NOTES

=========

BorderLayout is default for contentpanes.

========

You can also create a BorderLayout like this :
  new BorderLayout()

resulting in no space between components.

.