A custom layout manager
introduction
Using the layout managers that are supplied with java
can result in interfaces that look very ugly.
The main problem is that the ui designer has little or no
control over the intended positions of the widgets being used.
The GridBagLayout comes closest to allowing UI designers
to develop good interfaces but is hopelessly complex.
It will be neccessary to use constraints
, just like the
GridBagLayout manager does. This is unfortunate but neccessary
as the interface provided by container
is not
sufficiently flexible.
Implementation
So here is a WorldLayout manager. press the button to get a frame and then try
and resize the frame.
This uses the following classes (stacked in the same order):