Java Reference
In-Depth Information
// The search & booking options panels are both added to an extra panel
JPanel optionsPanel = new JPanel(new BorderLayout());
optionsPanel.add(searchPanel, BorderLayout.NORTH);
optionsPanel.add(bookPanel, BorderLayout.SOUTH);
// The the tablePanel and optionsPanel are added to the JFrame
theFrame.add(tablePanel, BorderLayout.CENTER);
theFrame.add(optionsPanel, BorderLayout.SOUTH);
theFrame.pack();
theFrame.setVisible(true);
}
}
Listing 8-20 shows roughly how we will be laying out the MainWindow for our client appli-
cation. We will be providing the complete code for the MainWindow class next; however, it is
worthwhile reading through the code presented in Listing 8-20 to ensure that you are comfort-
able with the layout concepts before continuing.
The contents of the screen generated by Listing 8-20 are shown in Figure 8-27.
Figure 8-27. The result of combining several frames
The search area and the booking area each contain multiple items laid out in a row. We can
use the FlowLayout for these two panes, as will be shown in Listing 8-21 in the next section.
Search WWH ::




Custom Search