What is the difference between a Frame and a JFrame?

  1. Frame is part of java.awt package and exists since JDK1.0. JFrame is part of javax.swing package and exists since JDK1.1.3 or something.
  2. Frame extends Window.
    JFrame extends Frame.
  3. You can directly add components to Frame. You add components to JFrame.getContentPane().
  4. JFrame implements javax.swing.RootPaneContainer and javax.accessibility.Accessible interface. The frame does not. By virtue of that JFrame gets all the benefits that you get from JRootPane using a delegation model. e.g. you can set the border on ((JComponent) JFrame.getRootPane()).setBorder(…)
  5. JFrame directly supports javax.swing.JMenuBar.
  6. JFrame supports the setting of close operation.