If components overlap, components at a higher depth are drawn on top of components at a lower depth. The relationship between components at the same depth is determined by their positions within the depth. Most programs don't explicitly use the root pane's layered pane, so we don't discuss it in this section. You can find information about it in The Root Pane , which provides an overview, and The Layered Pane , which has further details. This section concentrates on telling you how to create your own layered pane and use it anywhere you might use a regular Swing container.
Swing provides two layered pane classes.
The first, JLayeredPane , is the class that root panes use and is the class used by the example in this section. The second, JDesktopPane , is a JLayeredPane subclass that's specialized for the task of holding internal frames. For examples of using JDesktopPane , see How to Use Internal Frames . The source file is LayeredPaneDemo.java . You will also need the dukeWaveRed.gif image file.