If you take a look at the previous answers or links, you will find out, between the lines, that the actual answer to the question is:
The root pane IS NOT the top-level container itself, but the top-level container HAS a root pane.
Since all Swing top-level containers (namely, JFrame
, JDialog
, JInternalFrame
and JApplet
) implement the RootPaneContainer
interface, this means that you can gain access to their root pane in a general way (no need to check if this is a JFrame or JDialog...)
About the second part of the question, the difference between pane and container, actually there is no difference, a pane is a java.awt.Container
(or any subclass, in particular javax.swing.JPanel
).
What is important to udnerstand is the various panes that exist in a Swing top-level container (root, content, glass, layered), for this you have to take a look at the links posted in previous answers.