Layout Managers and Nesting Panels

You can nest panels within cells using the following layout managers: To create card panels or Tabbed Folders, see Creating Tabbed Folders and Card Panels.

To use the gridbag layout panel:

  1. Select the GridBag Layout Panel component in the Panel palette tab.
  2. Click in the cell where you want to place the component.
  3. Click in the single cell to select it and use the arrow keys to add rows and columns.
  4. Add components to the grid by selecting them from the palette and clicking in the desired cells.

Components in the nested gridbag can be resized. See Resizing the Layout for details.


A shortcut for placing a component into a gridbag layout panel:

  1. Select a component you have already inserted into the layout grid.
  2. Choose GUI -> Nest Panel.

    The component is automatically placed within a gridbag layout panel.

To use the flow layout panel:

  1. Select the Flow Layout Panel component in the Panel palette tab.
  2. Click in the cell where you want to place the flow panel.
  3. Open the attribute editor by clicking on its button in the toolbar.
  4. Click on the Edit items button to open the Flow Panel dialog box.
  5. Click on the Insert button in the dialog box to create a gridbag for the panel.
  6. Enter a unique ID in the Name box for the selected gridbag.
  7. Click Apply to add the gridbag to the panel.
  8. Click in the single cell to select it and use the arrow keys to add rows and columns.
  9. Add components to the grid by selecting them from the palette and clicking in the cells where you want to place the components.
  10. Continue with steps 3-6 to add more gridbags to the panel.


Components in grids within flow panels do not resize.

Special Attributes

hgap The horizontal distance (in pixels) between components. Also controls the distance of the leftmost and rightmost components from the edges of the panel.
items A dialog box that enables you to add and delete panels from the flow layout panel and to change the names of those panels.
labelAlignment Sets the position (left, right, center) of the label on the top edge of the panel.
vgap The vertical distance (in pixels) between rows of components. Also controls the distance between components and the top and bottom edges of the panel.

To use the border layout panel:

  1. Select the Border Layout Panel component in the Panel palette tab.
  2. Click in the cell where you want to place the border panel.
  3. Click in the single cell to select it and use the arrow keys to add rows and columns.

    To add a single component, click on a component in the palette and click in the section where you want to place the component.


To resize a component in a border layout section, you must do two things:

  1. Select the component and use the resize controls to allow the component to expand.
  2. Select the Border Layout panel and use the resize controls to allow the panel to stretch. Single-line text fields within a Border Layout panel expand in the horizontal direction only.

For more information on resizing components, see Resizing the Window.

Special Attributes

labelAlignment Sets the position (left, right, center) of the label on the top edge of the panel.
useCenter Removes or includes the center cell in the panel.
useEast Removes or includes the east cell in the panel.
useNorth Removes or includes the north cell in the panel.
useSouth Removes or includes the south cell in the panel.
useWest Removes or includes the west cell in the panel.

See also:

GUI Builder Palette
Laying Out the Interface
Generating Java Source Code
Adding Operations to Components

Visual Java GUI Builder API Documentation
Visual Java GUI Builder Runtime Packages
Class Hierarchy
Index of All Fields and Methods