Sample Code |
Container |
Description |
|
|
Applet |
This subclass of Panel is part of the java.applet package. It is the base class for all applets. |
Container |
The base class from which all containers inherit |
Dialog |
A window suitable for dialog boxes |
Frame |
A window suitable for use as the main window of an application. |
Panel |
Generic container used to create nested layouts |
ScrollPane |
A container that contains a single child and allows that child to be scrolled vertically and horizontally |
Window |
A container with no title bar or other decoration, suitable for pop-up menus and similar uses |
Container |
Description |
|
|
Box |
General-purpose container that arranges children using BoxLayout layout manager |
JApplet |
A java.applet.Applet subclass that contains a JRootPane to add Swing features, such as support for menu bars to applets |
JDesttopPane |
A container for JInternalFrame components; simulates the operation of a desktop within a single window. |
JDialog |
The container used to display dialog boxes in Swing |
JFrame |
The container used for top-level windows in Swing. |
JInternalFrame |
A nested window container. Behaves like a JFrame and displays a Title Bar and resize handles but is not an independent window and is constrained to appear within bounds of its parent container. |
JLayeredPane |
Container that allows its children to overlap and manages the stacking order of those children |
JPanel |
A generic container for grouping Swing components. Typically used with an appropriate layout manager |
JRootPane |
A complex container used internally by JApplet, JDialog, JFrame and others. |
JScrollPane |
Container that allows a single child component to be scrolled horizontally or vertically. |
JSplitPane |
Container that displays two children by splitting itself horizontally or vertically |
JTabbedPane |
Displays one child at a time, allowing the user to select the currently displayed child by clicking on tabs. |
JViewPort |
Fixed-size container that displays a portion of a single larger child. |
JWindow |
Top-level Swing window that does not display a titlebar, resize handles, or any other decorations |
Manager |
Description |
|
|
BorderLayout |
Lays out a maximum of five components: one along each of the four borders of the container and one in the center. When using this layout manager, you must add components to the container using a two-argument version of the add() method. The constraint argument should be one of the strings "North", "East", "South", "West", or "Center". |
CardLayout |
Makes each component as large as the container and displays only one at a time. Various methods change the currently displayed component |
FlowLayout |
Arranges components like words on a page; from left to right in rows and then top to bottom as each row fills. Rows may be left, center, or right justified. |
GridBagLayout |
A flexible manager that arranges components in a grid with variable-sized cells. Allows control over the way each component is resized when the container changes size. |
GridLayout |
Makes all components the same size and arranges them in a grid of specified dimensions. Parameters are number rows, number cols, int hgap, int vgap. If either the number of rows or number of columns is set to 0, its value is computed from the other dimension and the total number of components. Simpler than GridBagLayout. |
BoxLayout |
Manger used by the Box container. Arranges children either in a row or a column. |
OverlayLayout |
Infrequently used - not covered here |
ScrollPaneLayout |
Specialized layout manager used by JScrollPane. |
ViewportLayout |
Specialized layout manager used by JViewport. |