听说awt里有FRAME类
swing里也有
有什么区别吗??

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【sure2003】截止到2008-06-23 14:22:37的历史汇总数据(不包括此帖):
    发帖数:172                发帖分:8266               
    结贴数:167                结贴分:8101               
    未结数:5                  未结分:165                
    结贴率:97.09 %            结分率:98.00 %            
    值得尊敬
      

  2.   

    An extended version of java.awt.Frame that adds support for the JFC/Swing component architecture. You can find task-oriented documentation about using JFrame in The Java Tutorial, in the section How to Make Frames. The JFrame class is slightly incompatible with Frame. Like all other JFC/Swing top-level containers, a JFrame contains a JRootPane as its only child. The content pane provided by the root pane should, as a rule, contain all the non-menu components displayed by the JFrame. This is different from the AWT Frame case. As a conveniance add and its variants, remove and setLayout have been overridden to forward to the contentPane as necessary. This means you can write:        frame.add(child);
     
    And the child will be added to the contentPane. The content pane will always be non-null. Attempting to set it to null will cause the JFrame to throw an exception. The default content pane will have a BorderLayout manager set on it. Refer to RootPaneContainer for details on adding, removing and setting the LayoutManager of a JFrame. 
    Unlike a Frame, a JFrame has some notion of how to respond when the user attempts to close the window. The default behavior is to simply hide the JFrame when the user closes the window. To change the default behavior, you invoke the method setDefaultCloseOperation(int). To make the JFrame behave the same as a Frame instance, use setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE).英语好可以看看DOC的描述 讲的比较清楚了 呵呵
      

  3.   

    awt里有FRAME类 ,swing里有 Jframe类,他们内容上的区别并不大,Jframe好看罢了,不过做界面一般都用swing里的Jframe类,因为它比较美观。
      

  4.   


    表面上看是这样实际上JFame相对对awt的Frame在架构上有很大改进
    这涉及到awt和swing的区别建议多搜搜资料我也是一知半解
      

  5.   


    3楼说的不太全面,区别在于awt里的Frame类被称为重量组件,而在swing里JFrame被称为轻量组件。
    两者不同的是JFrame是Frame的子类,他不仅包含Jfame组件里的所有特性,还有自己许多的新特性。
    具体都有什么特性楼主可以找些资料来看一看,就不给你罗列了。
      

  6.   

    可以参考一下Java文档的JRootPane类和RootPaneContainer接口的说明 
    默认情况下JFrame的getContentPane().add()和直接add是一样的 
    都会作用在JFrame的JRootPane组件的contentPane上(轻量级容器) 
    如果设置setRootPaneCheckingEnabled(false)的话,直接add将是直接作用在JFrame上(重量级容器) 
    容器之间的的层次结构,在Jave文档里有描述 
    至于JFrame和Frame的区别,估计也就是,前者是可以支持轻量级开发(通过设置可以转成重量级),后者则是重量级 
    所谓轻重级,估计是针对系统底层管理而言 
    也就是JFrame这些轻量级组件都是完全由JVM管理,即如果是Win系统的话,通过FindWindow等Window的API是取不到该组件的句柄的,也不能对该组件通过WinAPI发送消息控制,而Frame要受到底层系统的管理,即如果是Win系统的话,可以通过Window的API进行消息拦截和控制