All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.JFrame

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Frame
                                   |
                                   +----com.sun.java.swing.JFrame

public class JFrame
extends Frame
The java.awt.Frame object attempted to insulate the developer from the actual composition of the Frame. This lead to a situation where many behaviors of Frame were undefined or difficult to understand. The JFrame component is shedding this 'insulation' and showing the developer exactly what is going on with the component. Hopefully this will allow finer grain control of the component.

The JFrame component contains a JRootPane as it's only child. The contentPane() should be the parent of any children of the JFrame. From the older java.awt.Window object you would normally do something:

       dialog.add(child);
 
Using JFrame the proper semantic is:
       dialog.getContentPane().add(child);
 
The same is true of setting LayoutManagers, removing components, listing children, etc. All these methods should normally be sent to the contentPane() instead of the JFrame itself. The contentPane() will always be non-null. Attempting to set it to null will cause the JFrame to throw an exception. The default contentPane() will have a BorderLayout manager set on it.

Please see the JRootPane documentation for a complete description of the contentPane(), glassPane(), and layeredPane() components.

See Also:
JRootPane

Variable Index

 o rootPane

Constructor Index

 o JFrame()
Constructs a new Frame that is initially invisible.
 o JFrame(String)
Constructs a new, initially invisible Frame with the specified title.

Method Index

 o createRootPane()
Called by the constructor methods to create the default rootPane.
 o frameInit()
Called by the constructors to init the JFrame properly.
 o getContentPane()
 o getGlassPane()
 o getJMenuBar()
 o getLayeredPane()
 o getRootPane()
 o processKeyEvent(KeyEvent)
 o setContentPane(Container)
 o setGlassPane(Component)
 o setJMenuBar(JMenuBar)
 o setLayeredPane(JLayeredPane)
 o setRootPane(JRootPane)

Variables

 o rootPane
 protected JRootPane rootPane

Constructors

 o JFrame
 public JFrame()
Constructs a new Frame that is initially invisible.

See Also:
setSize, setVisible
 o JFrame
 public JFrame(String title)
Constructs a new, initially invisible Frame with the specified title.

Parameters:
title - the title for the frame
See Also:
setSize, setVisible

Methods

 o frameInit
 protected void frameInit()
Called by the constructors to init the JFrame properly.

 o createRootPane
 protected JRootPane createRootPane()
Called by the constructor methods to create the default rootPane.

 o processKeyEvent
 protected void processKeyEvent(KeyEvent e)
Overrides:
processKeyEvent in class Component
 o setJMenuBar
 public void setJMenuBar(JMenuBar menu)
 o getJMenuBar
 public JMenuBar getJMenuBar()
 o setContentPane
 public void setContentPane(Container content)
 o getContentPane
 public Container getContentPane()
 o setLayeredPane
 public void setLayeredPane(JLayeredPane layered)
 o getLayeredPane
 public JLayeredPane getLayeredPane()
 o setGlassPane
 public void setGlassPane(Component glass)
 o getGlassPane
 public Component getGlassPane()
 o setRootPane
 protected void setRootPane(JRootPane root)
 o getRootPane
 public JRootPane getRootPane()

All Packages  Class Hierarchy  This Package  Previous  Next  Index