Save This Page
Home » openjdk-7 » javax » swing » [javadoc | source]
javax.swing
public class: JFrame [javadoc | source]
java.lang.Object
   java.awt.Component
      java.awt.Container
         java.awt.Window
            java.awt.Frame
               javax.swing.JFrame

All Implemented Interfaces:
    HasGetTransferHandler, Accessible, RootPaneContainer, WindowConstants, MenuContainer, Serializable, ImageObserver

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 javax.swing.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 . To make the JFrame behave the same as a Frame instance, use setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE).

For more information on content panes and other features that root panes provide, see Using Top-Level Containers in The Java Tutorial.

In a multi-screen environment, you can create a JFrame on a different screen device. See java.awt.Frame for more information.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder .

Nested Class Summary:
protected class  JFrame.AccessibleJFrame  This class implements accessibility support for the JFrame class. It provides an implementation of the Java Accessibility API appropriate to frame user-interface elements. 
Field Summary
public static final  int EXIT_ON_CLOSE    The exit application default window close operation. If a window has this set as the close operation and is closed in an applet, a SecurityException may be thrown. It is recommended you only use this in an application.

    since: 1.3 -
 
protected  JRootPane rootPane    The JRootPane instance that manages the contentPane and optional menuBar for this frame, as well as the glassPane. 
protected  boolean rootPaneCheckingEnabled    If true then calls to add and setLayout will be forwarded to the contentPane. This is initially false, but is set to true when the JFrame is constructed. 
protected  AccessibleContext accessibleContext    The accessible context property. 
Fields inherited from java.awt.Frame:
DEFAULT_CURSOR,  CROSSHAIR_CURSOR,  TEXT_CURSOR,  WAIT_CURSOR,  SW_RESIZE_CURSOR,  SE_RESIZE_CURSOR,  NW_RESIZE_CURSOR,  NE_RESIZE_CURSOR,  N_RESIZE_CURSOR,  S_RESIZE_CURSOR,  W_RESIZE_CURSOR,  E_RESIZE_CURSOR,  HAND_CURSOR,  MOVE_CURSOR,  NORMAL,  ICONIFIED,  MAXIMIZED_HORIZ,  MAXIMIZED_VERT,  MAXIMIZED_BOTH,  maximizedBounds,  title,  menuBar,  resizable,  undecorated,  mbManagement,  ownedWindows
Fields inherited from java.awt.Window:
warningString,  icons,  systemSyncLWRequests,  syncLWRequests,  beforeFirstShow,  OPENED,  state,  ownedWindowList,  showWithParent,  modalBlocker,  modalExclusionType,  windowListener,  windowStateListener,  windowFocusListener,  inputContext,  isInShow,  isTrayIconWindow,  anchor
Fields inherited from java.awt.Container:
layoutMgr,  containerListener,  listeningChildren,  listeningBoundsChildren,  descendantsCount,  preserveBackgroundColor,  INCLUDE_SELF,  SEARCH_HEAVYWEIGHTS,  modalComp,  modalAppContext
Fields inherited from java.awt.Component:
peer,  parent,  appContext,  x,  y,  width,  height,  foreground,  background,  font,  peerFont,  cursor,  locale,  bufferStrategy,  ignoreRepaint,  visible,  enabled,  dropTarget,  popups,  focusTraversalKeys,  LOCK,  minSize,  minSizeSet,  prefSize,  prefSizeSet,  maxSize,  maxSizeSet,  componentOrientation,  newEventsOnly,  componentListener,  focusListener,  hierarchyListener,  hierarchyBoundsListener,  keyListener,  mouseListener,  mouseMotionListener,  mouseWheelListener,  inputMethodListener,  windowClosingException,  actionListenerK,  adjustmentListenerK,  componentListenerK,  containerListenerK,  focusListenerK,  itemListenerK,  keyListenerK,  mouseListenerK,  mouseMotionListenerK,  mouseWheelListenerK,  textListenerK,  ownedWindowK,  windowListenerK,  inputMethodListenerK,  hierarchyListenerK,  hierarchyBoundsListenerK,  windowStateListenerK,  windowFocusListenerK,  eventMask,  isInc,  incRate,  TOP_ALIGNMENT,  CENTER_ALIGNMENT,  BOTTOM_ALIGNMENT,  LEFT_ALIGNMENT,  RIGHT_ALIGNMENT,  isPacked,  backgroundEraseDisabled,  eventCache,  accessibleContext
Constructor:
 public JFrame() throws HeadlessException 
    Constructs a new frame that is initially invisible.

    This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale.

    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    Component#setSize
    Component#setVisible
    JComponent#getDefaultLocale
    exception: HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
 public JFrame(GraphicsConfiguration gc) 
    Creates a Frame in the specified GraphicsConfiguration of a screen device and a blank title.

    This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale.

    Parameters:
    gc - the GraphicsConfiguration that is used to construct the new Frame; if gc is null, the system default GraphicsConfiguration is assumed
    Throws:
    IllegalArgumentException - if gc is not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    JComponent#getDefaultLocale
    exception: IllegalArgumentException - if gc is not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
    since: 1.3 -
 public JFrame(String title) throws HeadlessException 
    Creates a new, initially invisible Frame with the specified title.

    This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale.

    Parameters:
    title - the title for the frame
    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    Component#setSize
    Component#setVisible
    JComponent#getDefaultLocale
    exception: HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
 public JFrame(String title,
    GraphicsConfiguration gc) 
    Creates a JFrame with the specified title and the specified GraphicsConfiguration of a screen device.

    This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale.

    Parameters:
    title - the title to be displayed in the frame's border. A null value is treated as an empty string, "".
    gc - the GraphicsConfiguration that is used to construct the new JFrame with; if gc is null, the system default GraphicsConfiguration is assumed
    Throws:
    IllegalArgumentException - if gc is not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    JComponent#getDefaultLocale
    exception: IllegalArgumentException - if gc is not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
    since: 1.3 -
Method from javax.swing.JFrame Summary:
addImpl,   createRootPane,   frameInit,   getAccessibleContext,   getContentPane,   getDefaultCloseOperation,   getGlassPane,   getGraphics,   getJMenuBar,   getLayeredPane,   getRootPane,   getTransferHandler,   isDefaultLookAndFeelDecorated,   isRootPaneCheckingEnabled,   paramString,   processWindowEvent,   remove,   repaint,   setContentPane,   setDefaultCloseOperation,   setDefaultLookAndFeelDecorated,   setGlassPane,   setIconImage,   setJMenuBar,   setLayeredPane,   setLayout,   setRootPane,   setRootPaneCheckingEnabled,   setTransferHandler,   update
Methods from java.awt.Frame:
addNotify,   constructComponentName,   getAccessibleContext,   getCursorType,   getExtendedState,   getFrames,   getIconImage,   getMaximizedBounds,   getMenuBar,   getState,   getTitle,   isResizable,   isUndecorated,   paramString,   postProcessKeyEvent,   remove,   removeNotify,   setBackground,   setCursor,   setExtendedState,   setIconImage,   setMaximizedBounds,   setMenuBar,   setOpacity,   setResizable,   setShape,   setState,   setTitle,   setUndecorated
Methods from java.awt.Window:
addNotify,   addOwnedWindow,   addPropertyChangeListener,   addPropertyChangeListener,   addWindowFocusListener,   addWindowListener,   addWindowStateListener,   adjustDecendantsOnParent,   adjustListeningChildrenOnParent,   applyCompoundShape,   applyCurrentShape,   applyResourceBundle,   applyResourceBundle,   canContainFocusOwner,   clearMostRecentFocusOwnerOnHide,   closeSplashScreen,   connectOwnedWindow,   constructComponentName,   createBufferStrategy,   createBufferStrategy,   deliverMouseWheelToAncestor,   dispatchEventImpl,   dispatchMouseWheelToAncestor,   dispose,   disposeImpl,   doDispose,   eventEnabled,   getAccessibleContext,   getAllUnblockedWindows,   getAllWindows,   getBackground,   getBufferStrategy,   getContainer,   getDocumentRoot,   getFocusCycleRootAncestor,   getFocusOwner,   getFocusTraversalKeys,   getFocusableWindowState,   getIconImages,   getInputContext,   getListeners,   getLocale,   getLocationOnWindow,   getModalBlocker,   getModalExclusionType,   getMostRecentFocusOwner,   getOpacity,   getOwnedWindows,   getOwnedWindows_NoClientCode,   getOwner,   getOwner_NoClientCode,   getOwnerlessWindows,   getShape,   getTemporaryLostComponent,   getToolkit,   getType,   getWarningString,   getWindowFocusListeners,   getWindowListeners,   getWindowStateListeners,   getWindows,   hide,   isActive,   isAlwaysOnTop,   isAlwaysOnTopSupported,   isAutoRequestFocus,   isFocusCycleRoot,   isFocusableWindow,   isFocused,   isLocationByPlatform,   isModalBlocked,   isModalExcluded,   isOpaque,   isRecursivelyVisible,   isShowing,   isValidateRoot,   mixOnReshaping,   pack,   paint,   postEvent,   postProcessKeyEvent,   postWindowEvent,   preProcessKeyEvent,   processEvent,   processWindowEvent,   processWindowFocusEvent,   processWindowStateEvent,   removeNotify,   removeOwnedWindow,   removeWindowFocusListener,   removeWindowListener,   removeWindowStateListener,   reshape,   setAlwaysOnTop,   setAutoRequestFocus,   setBackground,   setBounds,   setBounds,   setClientSize,   setCursor,   setFocusCycleRoot,   setFocusableWindowState,   setGraphicsConfiguration,   setIconImage,   setIconImages,   setLocation,   setLocation,   setLocationByPlatform,   setLocationRelativeTo,   setMinimumSize,   setModalBlocked,   setModalExclusionType,   setOpacity,   setShape,   setSize,   setSize,   setTemporaryLostComponent,   setType,   setVisible,   show,   toBack,   toBack_NoClientCode,   toFront,   toFront_NoClientCode,   updateChildFocusableWindowState,   updateChildrenBlocking,   updateZOrder
Methods from java.awt.Container:
add,   add,   add,   add,   add,   addContainerListener,   addImpl,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   adjustDecendantsOnParent,   adjustDescendants,   adjustListeningChildren,   applyComponentOrientation,   areFocusTraversalKeysSet,   canContainFocusOwner,   checkGD,   clearCurrentFocusCycleRootOnHide,   clearMostRecentFocusOwnerOnHide,   containsFocus,   countComponents,   countHierarchyMembers,   createChildHierarchyEvents,   createHierarchyEvents,   decreaseComponentCount,   deliverEvent,   dispatchEventImpl,   dispatchEventToSelf,   doLayout,   eventEnabled,   findComponentAt,   findComponentAt,   findComponentAt,   findComponentAtImpl,   getAccessibleAt,   getAccessibleChild,   getAccessibleChildrenCount,   getAlignmentX,   getAlignmentY,   getComponent,   getComponentAt,   getComponentAt,   getComponentCount,   getComponentZOrder,   getComponents,   getComponentsSync,   getComponents_NoClientCode,   getContainerListeners,   getDropTargetEventTarget,   getFocusTraversalKeys,   getFocusTraversalPolicy,   getHeavyweightContainer,   getInsets,   getLayout,   getListeners,   getMaximumSize,   getMinimumSize,   getMouseEventTarget,   getMousePosition,   getOpaqueShape,   getPreferredSize,   getTraversalRoot,   hasHeavyweightDescendants,   hasLightweightDescendants,   increaseComponentCount,   initializeFocusTraversalKeys,   insets,   invalidate,   invalidateParent,   invalidateTree,   isAncestorOf,   isFocusCycleRoot,   isFocusCycleRoot,   isFocusTraversalPolicyProvider,   isFocusTraversalPolicySet,   isRecursivelyVisibleUpToHeavyweightContainer,   isSameOrAncestorOf,   isValidateRoot,   layout,   lightweightPaint,   lightweightPrint,   list,   list,   locate,   minimumSize,   mixOnHiding,   mixOnReshaping,   mixOnShowing,   mixOnValidating,   mixOnZOrderChanging,   numListening,   paint,   paintComponents,   paintHeavyweightComponents,   paramString,   postProcessKeyEvent,   postsOldMouseEvents,   preProcessKeyEvent,   preferredSize,   print,   printComponents,   printHeavyweightComponents,   processContainerEvent,   processEvent,   proxyEnableEvents,   recursiveApplyCurrentShape,   recursiveApplyCurrentShape,   recursiveApplyCurrentShape,   recursiveSubtractAndApplyShape,   recursiveSubtractAndApplyShape,   recursiveSubtractAndApplyShape,   remove,   remove,   removeAll,   removeContainerListener,   removeNotify,   setComponentZOrder,   setFocusCycleRoot,   setFocusTraversalKeys,   setFocusTraversalPolicy,   setFocusTraversalPolicyProvider,   setFont,   setLayout,   transferFocusDownCycle,   update,   updateGraphicsData,   validate,   validateTree,   validateUnconditionally
Methods from java.awt.Component:
action,   add,   addComponentListener,   addFocusListener,   addHierarchyBoundsListener,   addHierarchyListener,   addInputMethodListener,   addKeyListener,   addMouseListener,   addMouseMotionListener,   addMouseWheelListener,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   adjustListeningChildrenOnParent,   applyComponentOrientation,   applyCompoundShape,   applyCurrentShape,   areBoundsValid,   areFocusTraversalKeysSet,   areInputMethodsEnabled,   autoProcessMouseWheel,   bounds,   canBeFocusOwner,   canBeFocusOwnerRecursively,   checkGD,   checkImage,   checkImage,   checkTreeLock,   checkWindowClosingException,   clearCurrentFocusCycleRootOnHide,   clearMostRecentFocusOwnerOnHide,   coalesceEvents,   constructComponentName,   contains,   contains,   containsFocus,   countHierarchyMembers,   createBufferStrategy,   createBufferStrategy,   createHierarchyEvents,   createImage,   createImage,   createVolatileImage,   createVolatileImage,   deliverEvent,   disable,   disableEvents,   dispatchEvent,   dispatchEventImpl,   dispatchMouseWheelToAncestor,   doLayout,   enable,   enable,   enableEvents,   enableInputMethods,   eventEnabled,   eventTypeEnabled,   findUnderMouseInWindow,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   getAccessControlContext,   getAccessibleContext,   getAccessibleIndexInParent,   getAccessibleStateSet,   getAlignmentX,   getAlignmentY,   getBackBuffer,   getBackground,   getBaseline,   getBaselineResizeBehavior,   getBounds,   getBounds,   getBoundsOp,   getBufferStrategy,   getColorModel,   getComponentAt,   getComponentAt,   getComponentListeners,   getComponentOrientation,   getContainer,   getContainingWindow,   getCursor,   getCursor_NoClientCode,   getDropTarget,   getFocusCycleRootAncestor,   getFocusListeners,   getFocusTraversalKeys,   getFocusTraversalKeysEnabled,   getFocusTraversalKeys_NoIDCheck,   getFont,   getFontMetrics,   getFont_NoClientCode,   getForeground,   getGraphics,   getGraphicsConfiguration,   getGraphicsConfiguration_NoClientCode,   getGraphics_NoClientCode,   getHWPeerAboveMe,   getHeight,   getHierarchyBoundsListeners,   getHierarchyListeners,   getIgnoreRepaint,   getInputContext,   getInputMethodListeners,   getInputMethodRequests,   getKeyListeners,   getListeners,   getLocale,   getLocation,   getLocation,   getLocationOnScreen,   getLocationOnScreen_NoTreeLock,   getLocationOnWindow,   getMaximumSize,   getMinimumSize,   getMouseListeners,   getMouseMotionListeners,   getMousePosition,   getMouseWheelListeners,   getName,   getNativeContainer,   getNextFocusCandidate,   getNormalShape,   getObjectLock,   getOpaqueShape,   getParent,   getParent_NoClientCode,   getPeer,   getPreferredSize,   getPropertyChangeListeners,   getPropertyChangeListeners,   getSiblingIndexAbove,   getSiblingIndexBelow,   getSize,   getSize,   getToolkit,   getToolkitImpl,   getTraversalRoot,   getTreeLock,   getWidth,   getX,   getY,   gotFocus,   handleEvent,   hasFocus,   hide,   imageUpdate,   initializeFocusTraversalKeys,   inside,   invalidate,   invalidateIfValid,   invalidateParent,   isAutoFocusTransferOnDisposal,   isBackgroundSet,   isCoalescingEnabled,   isCursorSet,   isDisplayable,   isDoubleBuffered,   isEnabled,   isEnabledImpl,   isFocusCycleRoot,   isFocusOwner,   isFocusTraversable,   isFocusTraversableOverridden,   isFocusable,   isFontSet,   isForegroundSet,   isInstanceOf,   isLightweight,   isMaximumSizeSet,   isMinimumSizeSet,   isMixingNeeded,   isNonOpaqueForMixing,   isOpaque,   isPreferredSizeSet,   isRecursivelyVisible,   isSameOrAncestorOf,   isShowing,   isValid,   isVisible,   isVisible_NoClientCode,   keyDown,   keyUp,   layout,   lightweightPaint,   lightweightPrint,   list,   list,   list,   list,   list,   locate,   location,   lostFocus,   minimumSize,   mixOnHiding,   mixOnReshaping,   mixOnShowing,   mixOnValidating,   mixOnZOrderChanging,   mouseDown,   mouseDrag,   mouseEnter,   mouseExit,   mouseMove,   mouseUp,   move,   nextFocus,   numListening,   paint,   paintAll,   paintHeavyweightComponents,   paramString,   pointRelativeToComponent,   postEvent,   postsOldMouseEvents,   preferredSize,   prepareImage,   prepareImage,   print,   printAll,   printHeavyweightComponents,   processComponentEvent,   processEvent,   processFocusEvent,   processHierarchyBoundsEvent,   processHierarchyEvent,   processInputMethodEvent,   processKeyEvent,   processMouseEvent,   processMouseMotionEvent,   processMouseWheelEvent,   relocateComponent,   remove,   removeComponentListener,   removeFocusListener,   removeHierarchyBoundsListener,   removeHierarchyListener,   removeInputMethodListener,   removeKeyListener,   removeMouseListener,   removeMouseMotionListener,   removeMouseWheelListener,   removeNotify,   removePropertyChangeListener,   removePropertyChangeListener,   repaint,   repaint,   repaint,   repaint,   requestFocus,   requestFocus,   requestFocus,   requestFocus,   requestFocusHelper,   requestFocusHelper,   requestFocusInWindow,   requestFocusInWindow,   requestFocusInWindow,   requestFocusInWindow,   reshape,   resize,   resize,   revalidate,   setAutoFocusTransferOnDisposal,   setBackground,   setBounds,   setBounds,   setBoundsOp,   setComponentOrientation,   setCursor,   setDropTarget,   setEnabled,   setFocusTraversalKeys,   setFocusTraversalKeysEnabled,   setFocusTraversalKeys_NoIDCheck,   setFocusable,   setFont,   setForeground,   setGraphicsConfiguration,   setIgnoreRepaint,   setLocale,   setLocation,   setLocation,   setMaximumSize,   setMinimumSize,   setName,   setPreferredSize,   setRequestFocusController,   setSize,   setSize,   setVisible,   show,   show,   size,   subtractAndApplyShape,   subtractAndApplyShapeBelowMe,   toString,   transferFocus,   transferFocus,   transferFocusBackward,   transferFocusBackward,   transferFocusUpCycle,   update,   updateCursorImmediately,   updateGraphicsData,   updateZOrder,   validate
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.JFrame Detail:
 protected  void addImpl(Component comp,
    Object constraints,
    int index) 
    Adds the specified child Component. This method is overridden to conditionally forward calls to the contentPane. By default, children are added to the contentPane instead of the frame, refer to javax.swing.RootPaneContainer for details.
 protected JRootPane createRootPane() 
    Called by the constructor methods to create the default rootPane.
 protected  void frameInit() 
    Called by the constructors to init the JFrame properly.
 public AccessibleContext getAccessibleContext() 
    Gets the AccessibleContext associated with this JFrame. For JFrames, the AccessibleContext takes the form of an AccessibleJFrame. A new AccessibleJFrame instance is created if necessary.
 public Container getContentPane() 
    Returns the contentPane object for this frame.
 public int getDefaultCloseOperation() 
    Returns the operation that occurs when the user initiates a "close" on this frame.
 public Component getGlassPane() 
    Returns the glassPane object for this frame.
 public Graphics getGraphics() 
    {@inheritDoc}
 public JMenuBar getJMenuBar() 
    Returns the menubar set on this frame.
 public JLayeredPane getLayeredPane() 
    Returns the layeredPane object for this frame.
 public JRootPane getRootPane() 
    Returns the rootPane object for this frame.
 public TransferHandler getTransferHandler() 
    Gets the transferHandler property.
 public static boolean isDefaultLookAndFeelDecorated() 
    Returns true if newly created JFrames should have their Window decorations provided by the current look and feel. This is only a hint, as certain look and feels may not support this feature.
 protected boolean isRootPaneCheckingEnabled() 
    Returns whether calls to add and setLayout are forwarded to the contentPane.
 protected String paramString() 
    Returns a string representation of this JFrame. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
 protected  void processWindowEvent(WindowEvent e) 
    Processes window events occurring on this component. Hides the window or disposes of it, as specified by the setting of the defaultCloseOperation property.
 public  void remove(Component comp) 
    Removes the specified component from the container. If comp is not the rootPane, this will forward the call to the contentPane. This will do nothing if comp is not a child of the JFrame or contentPane.
 public  void repaint(long time,
    int x,
    int y,
    int width,
    int height) 
    Repaints the specified rectangle of this component within time milliseconds. Refer to RepaintManager for details on how the repaint is handled.
 public  void setContentPane(Container contentPane) 
    Sets the contentPane property. This method is called by the constructor.

    Swing's painting architecture requires an opaque JComponent in the containment hiearchy. This is typically provided by the content pane. If you replace the content pane it is recommended you replace it with an opaque JComponent.

 public  void setDefaultCloseOperation(int operation) 
    Sets the operation that will happen by default when the user initiates a "close" on this frame. You must specify one of the following choices:

    • DO_NOTHING_ON_CLOSE (defined in WindowConstants): Don't do anything; require the program to handle the operation in the windowClosing method of a registered WindowListener object.
    • HIDE_ON_CLOSE (defined in WindowConstants): Automatically hide the frame after invoking any registered WindowListener objects.
    • DISPOSE_ON_CLOSE (defined in WindowConstants): Automatically hide and dispose the frame after invoking any registered WindowListener objects.
    • EXIT_ON_CLOSE (defined in JFrame): Exit the application using the System exit method. Use this only in applications.

    The value is set to HIDE_ON_CLOSE by default. Changes to the value of this property cause the firing of a property change event, with property name "defaultCloseOperation".

    Note: When the last displayable window within the Java virtual machine (VM) is disposed of, the VM may terminate. See AWT Threading Issues for more information.

 public static  void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated) 
    Provides a hint as to whether or not newly created JFrames should have their Window decorations (such as borders, widgets to close the window, title...) provided by the current look and feel. If defaultLookAndFeelDecorated is true, the current LookAndFeel supports providing window decorations, and the current window manager supports undecorated windows, then newly created JFrames will have their Window decorations provided by the current LookAndFeel. Otherwise, newly created JFrames will have their Window decorations provided by the current window manager.

    You can get the same effect on a single JFrame by doing the following:

       JFrame frame = new JFrame();
       frame.setUndecorated(true);
       frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    
 public  void setGlassPane(Component glassPane) 
    Sets the glassPane property. This method is called by the constructor.
 public  void setIconImage(Image image) 
    {@inheritDoc}
 public  void setJMenuBar(JMenuBar menubar) 
    Sets the menubar for this frame.
 public  void setLayeredPane(JLayeredPane layeredPane) 
    Sets the layeredPane property. This method is called by the constructor.
 public  void setLayout(LayoutManager manager) 
    Sets the LayoutManager. Overridden to conditionally forward the call to the contentPane. Refer to javax.swing.RootPaneContainer for more information.
 protected  void setRootPane(JRootPane root) 
    Sets the rootPane property. This method is called by the constructor.
 protected  void setRootPaneCheckingEnabled(boolean enabled) 
    Sets whether calls to add and setLayout are forwarded to the contentPane.
 public  void setTransferHandler(TransferHandler newHandler) 
    Sets the {@code transferHandler} property, which is a mechanism to support transfer of data into this component. Use {@code null} if the component does not support data transfer operations.

    If the system property {@code suppressSwingDropSupport} is {@code false} (the default) and the current drop target on this component is either {@code null} or not a user-set drop target, this method will change the drop target as follows: If {@code newHandler} is {@code null} it will clear the drop target. If not {@code null} it will install a new {@code DropTarget}.

    Note: When used with {@code JFrame}, {@code TransferHandler} only provides data import capability, as the data export related methods are currently typed to {@code JComponent}.

    Please see How to Use Drag and Drop and Data Transfer, a section in The Java Tutorial, for more information.

 public  void update(Graphics g) 
    Just calls paint(g). This method was overridden to prevent an unnecessary call to clear the background.