Java Reference
In-Depth Information
TextField with the generated sentence, a label "monkey," and a choice containing the names of the
monkeys, as shown in Figure 4.4 .
Figure 4.4. The nested layouts used in the improved version of the typing monkeys
application.
In order to achieve this layout, we create a new control panel having the layout set to BorderLayout .
In the east area of the new control panel we put a grid-layout label panel, and in the center area we put
a grid-layout field panel. Because both subpanels will contain the same number of components and
GridLayout distributes space equally between the components, the components will be aligned
vertically as desired. The new control panel is then inserted in the north area of the application Frame .
Listing 4.4 shows our enhanced typing monkeys application. The new layout code is marked bold in
order to highlight the interesting additions to the previous example. Figure 4.5 shows the complete user
interface of the extended application.
Figure 4.5. The improved version of the typing monkeys application.
 
 
Search WWH ::




Custom Search