SomeClass
SomeComponent
. Below is a simple example of the source
generated for a layout with two components.
From this example it can be seen that the code creates instances of
SomeComponent
with the allocated text caption. Only one instance
of GridBagConstraints
is used for efficiency. Only constraints that change
are set before the component is added to the layout. The programmer must obviously
substitute in the instances of actual components such as Button
or
JPanel
which are to be actually used in the layout.