|
|
|
|
The layout manager
The
layout manager positions components inside a container (e.g., Panel). It also
re-positions components automatically when the contained size changes.
There
are several different layout manager types, all subclasses of LayoutManager.
The layout manager may re-size components if they don't have a fixed size.
The
use of a layout manager relieves the programmer of the effort of managing the
screen layout when large numbers of components are in use, but it does take
some time to get used to. The great advantage of the layout manager is that it
usually responds sensibly to changes in the size of a program's main window, by
re-organizing the components so that they are all visible (if possible). The
disadvantage of a layout manager is that it is difficult to specify exactly how the display should appear.
The
default layout manager is called the 'flow' layout manager. As each new object
is added, it positions it to the right of the previous one. If there is no room
to do this, it positions it below and at the left-hand edge of the window. Thus
the order of placement of objects is the same as the order of reading English
text. There are other types of layout manager, as will be shown below.
|
|