Creating a Tabbed Pane

A tabbed pane is a UI container that groups components such as buttons, checkboxes, and text fields on multiple panels. Each panel has a title and a tab that the end user clicks to view the panel contents.

To create a tabbed pane:

  1. Create a frame or other container .
  2. In the Swing Containers page of the Component Palette, click the JTabbedPane component.
  3. Click inside the container in the Java Visual Editor to drop the tabbed pane with its default size.
  4. Resize the tabbed pane as desired.
  5. To add the first tab to the tabbed pane, click the JPanel component in the Swing Containers page of the Component Palette, then click on the JTabbedPane inside the Java Visual Editor.
  6. To add additional tabs to the tabbed pane, after you click the JPanel component in the Component Palette, you must click specifically on the tab itself of a previously added tab panel.
  7. To add a layout panel (one that has no tabs) to any of the tabbed pane tabs, click the JPanel component in the Swing Containers page of the Component Palette, then click the content area of the JTabbedPane inside the Java Visual Editor (in this case, do not click the tab itself).

    To work with a panel that is not currently the top most tab in the Java Visual Editor, click directly on the tab. When you select tab, you also raise the panel to the top of the stacking order. Alternatively, you can select tab panels by choosing the desired panel in the Structure Window. To view the panels you have added to the tabbed pane, expand the UI folder, expand the dataPanel node, and finally expand the JTabbedPane node to see the list of JPanels.


About Containers