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 to a top-level container such as a Jframe, and you should add components to a container (called the content pane) that is itself contained by the JFrame.
3、Swing provides three generally useful top-level container classes: JFrame, JDialog, and JApplet 至於其他的不同,它們既然是不同的類,自然不同了,可以看看API文件。
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 to a top-level container such as a Jframe, and you should add components to a container (called the content pane) that is itself contained by the JFrame.
3、Swing provides three generally useful top-level container classes: JFrame, JDialog, and JApplet 至於其他的不同,它們既然是不同的類,自然不同了,可以看看API文件。