Most UI designs in Java use more than one type of layout to get the desired component positions by nesting multiple panels with different layouts in the main container. You can also nest panels within other panels to gain more control over the placement of components. By creating a composite design, and by using the appropriate layout manager for each panel, you can group and arrange components in a way that is both functional and portable.
For example, the following sketch demonstrates the use of nested panels with different layouts. The solid gray objects are the buttons and other visible components in the UI which are nested in various levels of panels.
To create nested panels:
When you add a panel to the UI design, it uses
FlowLayout. Change the layout to null
initially because it is
the easiest layout to work with during the design process. After you
have all the panels and other components in place in your UI, you
will set it to its final layout.
To locate a specific panel in the Java Visual Editor, you can select the panel in the Structure window.
Copyright © 1997, 2004, Oracle. All rights reserved.