Setting the Layout Manager

See Also

Containers are created with default layout managers. Most containers use BorderLayout by default. Panels use FlowLayout by default.

Layout managers do not apply to all containers. For example, JScrollPane, JTabbedPane, JDesktopPane, and JSplitPane have their own special layouts that cannot be changed.

You can change the layout manager of most containers using the Palette window, Form Editor, or Inspector window.

To set the layout manager using the Palette window:

  1. Click Layouts in the Palette window and select the layout manager.

    If you are not yet familiar with the icons that represent the various layout managers, move the pointer over each image to see the tool tips.

    Alternatively, if you have chosen the small palette, click the Add Mode button add mode button in the Palette window and choose a layout manager from the menu that is displayed.

  2. On the Form Editor, click inside the container whose layout you want to change.

To set the layout manager using the Form Editor or Inspector window:

  1. Select the target container. Right-click the component in the Form Editor or the node for the container in the Inspector window.
  2. From the contextual menu, choose the desired layout from the Set Layout submenu.
Tip When you change layouts, the IDE remembers the properties of the discarded layout manager. If you change the layout manager back, the component looks the same as it previously looked with that layout manager.
See Also
Palette Window
Setting Layout Properties
Using a Custom Layout Manager

Legal Notices