JFrame是顶级容器,而JPanel是普通容器。包含Swing组件的程序必须包含一个顶级容器,而Swing组件不可以直接加入到顶级容器中。Sun文档有下列相关的解释:1、The containment hierarchy for any window or applet that contains Swing components must have a Swing top-level container at the root of the hierarchy. 2、You don 't add components directly...