Previous | Next | Trail Map | Creating a User Interface | Using the JFC/Swing Packages

How to Use Panels

This page will cover the use of JPanel(in the API reference documentation). For now, we provide a list of examples that use panels with different layout managers and one that subclasses JPanel:

Example Where Described Notes
ButtonDemo.java How to Use Buttons. A subclass of JPanel. Uses FlowLayout, the default layout manager of a panel.
ToolBarDemo.java How to Use Toolbar. Shows a panel with three components laid out by BorderLayout.
BorderDemo.java How to Use Borders. Contains several panels that use GridBagLayout.
BoxLayoutDemo.java How to Use BoxLayout. Illustrates the use of a panel with Swing's BoxLayout manager.
LabelDemo.java How to Use Labels. Uses a panel whose three components are laid out in a grid by GridLayout.
TabbedPaneDemo.java How to Use Tabbed panes. A subclass of JPanel that creates its GUI in its constructor and uses a GridLayout.

The JPanel API

[PENDING: Put tables here]


Previous | Next | Trail Map | Creating a User Interface | Using the JFC/Swing Packages