Top Description Inners Fields Constructors Methods
javax.swing

public Class JFrame

extends Frame
implements WindowConstants, Accessible, RootPaneContainer, HasGetTransferHandler
Class Inheritance
All Implemented Interfaces
javax.swing.TransferHandler.HasGetTransferHandler, javax.swing.RootPaneContainer, javax.accessibility.Accessible, javax.swing.WindowConstants
Known Direct Subclasses
sun.awt.im.InputMethodJFrame
Annotations
@JavaBean
defaultProperty:JMenuBar
description:A toplevel window which can be minimized to an icon.
@SwingContainer
delegate:getContentPane
@SuppressWarnings:serial
Imports
java.awt.AWTEvent, .BorderLayout, .Component, .Container, .Frame, .Graphics, .GraphicsConfiguration, .HeadlessException, .Image, .LayoutManager, java.awt.event.WindowEvent, java.beans.JavaBean, .BeanProperty, javax.accessibility.Accessible, .AccessibleContext, .AccessibleState, .AccessibleStateSet

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 convenience, the add, remove, and setLayout methods of this class are overridden, so that they delegate calls to the corresponding methods of the ContentPane. For example, you can add a child component to a frame as follows:

      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 JavaBeans has been added to the java.beans package. Please see java.beans.XMLEncoder.

Authors
Jeff Dinkins, Georges Saab, David Kloba
Since
1.2
See Also
JRootPane, setDefaultCloseOperation, java.awt.event.WindowListener#windowClosing, javax.swing.RootPaneContainer

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
JFrame.AccessibleJFrame

This class implements accessibility support for the JFrame class.

Field Summary

Modifier and TypeField and Description
protected AccessibleContext
accessibleContext

Hides java.awt.Component.accessibleContext.

The accessible context property.
private int
private static final Object
defaultLookAndFeelDecoratedKey

Key into the AppContext, used to check if should provide decorations by default.

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.

private TransferHandler
transferHandler

The TransferHandler for this frame.

Inherited from java.awt.Frame:
CROSSHAIR_CURSORDEFAULT_CURSORE_RESIZE_CURSORHAND_CURSORICONIFIEDMAXIMIZED_BOTHMAXIMIZED_HORIZMAXIMIZED_VERTMOVE_CURSORN_RESIZE_CURSORNE_RESIZE_CURSORNORMALNW_RESIZE_CURSORS_RESIZE_CURSORSE_RESIZE_CURSORSW_RESIZE_CURSORTEXT_CURSORW_RESIZE_CURSORWAIT_CURSOR

Constructor Summary

AccessConstructor and Description
public
JFrame()

Constructs a new frame that is initially invisible.

public
JFrame(GraphicsConfiguration
the GraphicsConfiguration that is used to construct the new Frame; if gc is null, the system default GraphicsConfiguration is assumed
gc
)

Creates a Frame in the specified GraphicsConfiguration of a screen device and a blank title.

public
JFrame(String
the title for the frame
title
)

Creates a new, initially invisible Frame with the specified title.

public
JFrame(String
the title to be displayed in the frame's border. A null value is treated as an empty string, "".
title
,
GraphicsConfiguration
the GraphicsConfiguration that is used to construct the new JFrame with; if gc is null, the system default GraphicsConfiguration is assumed
gc
)

Creates a JFrame with the specified title and the specified GraphicsConfiguration of a screen device.

Method Summary

Modifier and TypeMethod and Description
protected void
addImpl(Component
the component to be enhanced
comp
,
Object
the constraints to be respected
constraints
,
int
the index
index
)

Overrides java.awt.Container.addImpl.

Adds the specified child Component.
protected JRootPane

Returns:

a new 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

Returns:

an AccessibleJFrame that serves as the AccessibleContext of this JFrame
getAccessibleContext
()

Overrides java.awt.Frame.getAccessibleContext.

Implements javax.accessibility.Accessible.getAccessibleContext.

Gets the AccessibleContext associated with this JFrame.
public Container

Returns:

the contentPane property
getContentPane
()

Implements javax.swing.RootPaneContainer.getContentPane.

Returns the contentPane object for this frame.
public int

Returns:

an integer indicating the window-close operation
getDefaultCloseOperation
()

Returns the operation that occurs when the user initiates a "close" on this frame.

public Component

Returns:

the glassPane property
getGlassPane
()

Implements javax.swing.RootPaneContainer.getGlassPane.

Returns the glassPane object for this frame.
public Graphics
getGraphics()

Overrides java.awt.Component.getGraphics.

Creates a graphics context for this component.
public JMenuBar

Returns:

the menubar for this frame
getJMenuBar
()

Returns the menubar set on this frame.

public JLayeredPane

Returns:

the layeredPane property
getLayeredPane
()

Implements javax.swing.RootPaneContainer.getLayeredPane.

Returns the layeredPane object for this frame.
public JRootPane

Returns:

the rootPane property
getRootPane
()

Implements javax.swing.RootPaneContainer.getRootPane.

Returns the rootPane object for this frame.
public TransferHandler

Returns:

the value of the transferHandler property
getTransferHandler
()

Implements javax.swing.TransferHandler.HasGetTransferHandler.getTransferHandler.

Gets the transferHandler property.
public static boolean

Returns:

true if look and feel should provide Window decorations.
isDefaultLookAndFeelDecorated
()

Returns true if newly created JFrames should have their Window decorations provided by the current look and feel.

protected boolean

Returns:

true if add and setLayout are forwarded; false otherwise
isRootPaneCheckingEnabled
()

Returns whether calls to add and setLayout are forwarded to the contentPane.

protected String

Returns:

a string representation of this JFrame
paramString
()

Overrides java.awt.Frame.paramString.

Returns a string representation of this JFrame.
protected void
processWindowEvent(final WindowEvent
the window event
e
)

Overrides java.awt.Window.processWindowEvent.

Processes window events occurring on this component.
public void
remove(Component
the component to be removed
comp
)

Overrides java.awt.Container.remove.

Removes the specified component from the container.
public void
repaint(long
maximum time in milliseconds before update
time
,
int
the x coordinate
x
,
int
the y coordinate
y
,
int
the width
width
,
int
the height
height
)

Overrides java.awt.Component.repaint.

Repaints the specified rectangle of this component within time milliseconds.
public void
setContentPane(Container
the contentPane object for this frame
contentPane
)

Implements javax.swing.RootPaneContainer.setContentPane.

Sets the contentPane property.
public void
setDefaultCloseOperation(int
the operation which should be performed when the user closes the frame
operation
)

Sets the operation that will happen by default when the user initiates a "close" on this frame.

public static void
setDefaultLookAndFeelDecorated(boolean
A hint as to whether or not current look and feel should provide window decorations
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.

public void
setGlassPane(Component
the glassPane object for this frame
glassPane
)

Implements javax.swing.RootPaneContainer.setGlassPane.

Sets the glassPane property.
public void
setIconImage(Image
the icon image to be displayed.
image
)

Overrides java.awt.Frame.setIconImage.

Sets the image to be displayed as the icon for this window.
public void
setJMenuBar(final JMenuBar
the menubar being placed in the frame
menubar
)

Sets the menubar for this frame.

public void
setLayeredPane(JLayeredPane
the layeredPane object for this frame
layeredPane
)

Implements javax.swing.RootPaneContainer.setLayeredPane.

Sets the layeredPane property.
public void
setLayout(LayoutManager
the LayoutManager
manager
)

Overrides java.awt.Container.setLayout.

Sets the LayoutManager.
protected void
setRootPane(JRootPane
the rootPane object for this frame
root
)

Sets the rootPane property.

protected void
setRootPaneCheckingEnabled(boolean
true if add and setLayout are forwarded, false if they should operate directly on the JFrame.
enabled
)

Sets whether calls to add and setLayout are forwarded to the contentPane.

public void
setTransferHandler(TransferHandler
the new TransferHandler
newHandler
)

Sets the transferHandler property, which is a mechanism to support transfer of data into this component.

public void
update(Graphics
the Graphics context in which to paint
g
)

Overrides java.awt.Container.update.

Just calls paint(g).
Inherited from java.awt.Frame:
addNotifygetCursorTypegetExtendedStategetFramesgetIconImagegetMaximizedBoundsgetMenuBargetStategetTitleisResizableisUndecoratedremoveremoveNotifysetBackgroundsetCursorsetExtendedStatesetMaximizedBoundssetMenuBarsetOpacitysetResizablesetShapesetStatesetTitlesetUndecorated

Field Detail

accessibleContextback to summary
protected AccessibleContext accessibleContext

Hides java.awt.Component.accessibleContext.

The accessible context property.

defaultCloseOperationback to summary
private int defaultCloseOperation
defaultLookAndFeelDecoratedKeyback to summary
private static final Object defaultLookAndFeelDecoratedKey

Key into the AppContext, used to check if should provide decorations by default.

rootPaneback to summary
protected JRootPane rootPane

The JRootPane instance that manages the contentPane and optional menuBar for this frame, as well as the glassPane.

See Also
JRootPane, RootPaneContainer
rootPaneCheckingEnabledback to summary
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.

See Also
isRootPaneCheckingEnabled, setRootPaneCheckingEnabled, javax.swing.RootPaneContainer
transferHandlerback to summary
private TransferHandler transferHandler

The TransferHandler for this frame.

Constructor Detail

JFrameback to summary
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.

Exceptions
HeadlessException:
if GraphicsEnvironment.isHeadless() returns true.
See Also
java.awt.GraphicsEnvironment#isHeadless, Component#setSize, Component#setVisible, JComponent#getDefaultLocale
JFrameback to summary
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:GraphicsConfiguration

the GraphicsConfiguration that is used to construct the new Frame; if gc is null, the system default GraphicsConfiguration is assumed

Exceptions
IllegalArgumentException:
if gc is not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
Since
1.3
See Also
java.awt.GraphicsEnvironment#isHeadless, JComponent#getDefaultLocale
JFrameback to summary
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:String

the title for the frame

Exceptions
HeadlessException:
if GraphicsEnvironment.isHeadless() returns true.
See Also
java.awt.GraphicsEnvironment#isHeadless, Component#setSize, Component#setVisible, JComponent#getDefaultLocale
JFrameback to summary
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:String

the title to be displayed in the frame's border. A null value is treated as an empty string, "".

gc:GraphicsConfiguration

the GraphicsConfiguration that is used to construct the new JFrame with; if gc is null, the system default GraphicsConfiguration is assumed

Exceptions
IllegalArgumentException:
if gc is not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
Since
1.3
See Also
java.awt.GraphicsEnvironment#isHeadless, JComponent#getDefaultLocale

Method Detail

addImplback to summary
protected void addImpl(Component comp, Object constraints, int index)

Overrides java.awt.Container.addImpl.

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.

Parameters
comp:Component

the component to be enhanced

constraints:Object

the constraints to be respected

index:int

the index

Exceptions
IllegalArgumentException:
  • if index is invalid
  • if adding the container's parent to itself
  • if adding a window to a container
See Also
setRootPaneCheckingEnabled, javax.swing.RootPaneContainer
createRootPaneback to summary
protected JRootPane createRootPane()

Called by the constructor methods to create the default rootPane.

Returns:JRootPane

a new JRootPane

frameInitback to summary
protected void frameInit()

Called by the constructors to init the JFrame properly.

getAccessibleContextback to summary
public AccessibleContext getAccessibleContext()

Overrides java.awt.Frame.getAccessibleContext.

Implements javax.accessibility.Accessible.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.

Returns:AccessibleContext

an AccessibleJFrame that serves as the AccessibleContext of this JFrame

getContentPaneback to summary
public Container getContentPane()

Implements javax.swing.RootPaneContainer.getContentPane.

Returns the contentPane object for this frame.

Returns:Container

the contentPane property

See Also
setContentPane, RootPaneContainer#getContentPane
getDefaultCloseOperationback to summary
public int getDefaultCloseOperation()

Returns the operation that occurs when the user initiates a "close" on this frame.

Returns:int

an integer indicating the window-close operation

See Also
setDefaultCloseOperation
getGlassPaneback to summary
public Component getGlassPane()

Implements javax.swing.RootPaneContainer.getGlassPane.

Returns the glassPane object for this frame.

Returns:Component

the glassPane property

See Also
setGlassPane, RootPaneContainer#getGlassPane
getGraphicsback to summary
public Graphics getGraphics()

Overrides java.awt.Component.getGraphics.

Doc from java.awt.Component.getGraphics.

Creates a graphics context for this component. This method will return null if this component is currently not displayable.

Returns:Graphics

a graphics context for this component, or null if it has none

Annotations
@BeanProperty
bound:false
Since
1.6
getJMenuBarback to summary
public JMenuBar getJMenuBar()

Returns the menubar set on this frame.

Returns:JMenuBar

the menubar for this frame

See Also
setJMenuBar
getLayeredPaneback to summary
public JLayeredPane getLayeredPane()

Implements javax.swing.RootPaneContainer.getLayeredPane.

Returns the layeredPane object for this frame.

Returns:JLayeredPane

the layeredPane property

See Also
setLayeredPane, RootPaneContainer#getLayeredPane
getRootPaneback to summary
public JRootPane getRootPane()

Implements javax.swing.RootPaneContainer.getRootPane.

Returns the rootPane object for this frame.

Returns:JRootPane

the rootPane property

Annotations
@BeanProperty
bound:false
hidden:true
description:the RootPane object for this frame.
See Also
setRootPane, RootPaneContainer#getRootPane
getTransferHandlerback to summary
public TransferHandler getTransferHandler()

Implements javax.swing.TransferHandler.HasGetTransferHandler.getTransferHandler.

Gets the transferHandler property.

Returns:TransferHandler

the value of the transferHandler property

Since
1.6
See Also
TransferHandler, setTransferHandler
isDefaultLookAndFeelDecoratedback to summary
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.

Returns:boolean

true if look and feel should provide Window decorations.

Since
1.4
isRootPaneCheckingEnabledback to summary
protected boolean isRootPaneCheckingEnabled()

Returns whether calls to add and setLayout are forwarded to the contentPane.

Returns:boolean

true if add and setLayout are forwarded; false otherwise

See Also
addImpl, setLayout, setRootPaneCheckingEnabled, javax.swing.RootPaneContainer
paramStringback to summary
protected String paramString()

Overrides java.awt.Frame.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.

Returns:String

a string representation of this JFrame

processWindowEventback to summary
protected void processWindowEvent(final WindowEvent e)

Overrides java.awt.Window.processWindowEvent.

Processes window events occurring on this component. Hides the window or disposes of it, as specified by the setting of the defaultCloseOperation property.

Parameters
e:WindowEvent

the window event

See Also
setDefaultCloseOperation, java.awt.Window#processWindowEvent
removeback to summary
public void remove(Component comp)

Overrides java.awt.Container.remove.

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.

Parameters
comp:Component

the component to be removed

Exceptions
NullPointerException:
if comp is null
See Also
add, javax.swing.RootPaneContainer
repaintback to summary
public void repaint(long time, int x, int y, int width, int height)

Overrides java.awt.Component.repaint.

Repaints the specified rectangle of this component within time milliseconds. Refer to RepaintManager for details on how the repaint is handled.

Parameters
time:long

maximum time in milliseconds before update

x:int

the x coordinate

y:int

the y coordinate

width:int

the width

height:int

the height

Since
1.6
See Also
RepaintManager
setContentPaneback to summary
public void setContentPane(Container contentPane)

Implements javax.swing.RootPaneContainer.setContentPane.

Sets the contentPane property. This method is called by the constructor.

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

Parameters
contentPane:Container

the contentPane object for this frame

Annotations
@BeanProperty
bound:false
hidden:true
description:The client area of the frame where child components are normally inserted.
Exceptions
IllegalComponentStateException:
(a runtime exception) if the content pane parameter is null
See Also
getContentPane, RootPaneContainer#setContentPane, JRootPane
setDefaultCloseOperationback to summary
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 WindowConstants): 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.

Parameters
operation:int

the operation which should be performed when the user closes the frame

Annotations
@BeanProperty
preferred:true
enumerationValues:WindowConstants.DO_NOTHING_ON_CLOSE, WindowConstants.HIDE_ON_CLOSE, WindowConstants.DISPOSE_ON_CLOSE, WindowConstants.EXIT_ON_CLOSE
description:The frame\'s default close operation.
Exceptions
IllegalArgumentException:
if defaultCloseOperation value isn't one of the above valid values
SecurityException:
if EXIT_ON_CLOSE has been specified and the SecurityManager will not allow the caller to invoke System.exit
See Also
addWindowListener, getDefaultCloseOperation, WindowConstants, java.lang.Runtime#exit(int)
setDefaultLookAndFeelDecoratedback to summary
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);
Parameters
defaultLookAndFeelDecorated:boolean

A hint as to whether or not current look and feel should provide window decorations

Since
1.4
See Also
javax.swing.LookAndFeel#getSupportsWindowDecorations
setGlassPaneback to summary
public void setGlassPane(Component glassPane)

Implements javax.swing.RootPaneContainer.setGlassPane.

Sets the glassPane property. This method is called by the constructor.

Parameters
glassPane:Component

the glassPane object for this frame

Annotations
@BeanProperty
bound:false
hidden:true
description:A transparent pane used for menu rendering.
See Also
getGlassPane, RootPaneContainer#setGlassPane
setIconImageback to summary
public void setIconImage(Image image)

Overrides java.awt.Frame.setIconImage.

Doc from java.awt.Frame.setIconImage.

Sets the image to be displayed as the icon for this window.

This method can be used instead of setIconImages() to specify a single image as a window's icon.

The following statement:

    setIconImage(image);
is equivalent to:
    ArrayList<Image> imageList = new ArrayList<Image>();
    imageList.add(image);
    setIconImages(imageList);

Note : Native windowing systems may use different images of differing dimensions to represent a window, depending on the context (e.g. window decoration, window list, taskbar, etc.). They could also use just a single image for all contexts or no image at all.

Parameters
image:Image

Doc from java.awt.Window.setIconImage.

the icon image to be displayed.

setJMenuBarback to summary
public void setJMenuBar(final JMenuBar menubar)

Sets the menubar for this frame.

Parameters
menubar:JMenuBar

the menubar being placed in the frame

Annotations
@BeanProperty
bound:false
hidden:true
description:The menubar for accessing pulldown menus from this frame.
See Also
getJMenuBar
setLayeredPaneback to summary
public void setLayeredPane(JLayeredPane layeredPane)

Implements javax.swing.RootPaneContainer.setLayeredPane.

Sets the layeredPane property. This method is called by the constructor.

Parameters
layeredPane:JLayeredPane

the layeredPane object for this frame

Annotations
@BeanProperty
bound:false
hidden:true
description:The pane that holds the various frame layers.
Exceptions
IllegalComponentStateException:
(a runtime exception) if the layered pane parameter is null
See Also
getLayeredPane, RootPaneContainer#setLayeredPane
setLayoutback to summary
public void setLayout(LayoutManager manager)

Overrides java.awt.Container.setLayout.

Sets the LayoutManager. Overridden to conditionally forward the call to the contentPane. Refer to javax.swing.RootPaneContainer for more information.

Parameters
manager:LayoutManager

the LayoutManager

See Also
setRootPaneCheckingEnabled, javax.swing.RootPaneContainer
setRootPaneback to summary
protected void setRootPane(JRootPane root)

Sets the rootPane property. This method is called by the constructor.

Parameters
root:JRootPane

the rootPane object for this frame

See Also
getRootPane
setRootPaneCheckingEnabledback to summary
protected void setRootPaneCheckingEnabled(boolean enabled)

Sets whether calls to add and setLayout are forwarded to the contentPane.

Parameters
enabled:boolean

true if add and setLayout are forwarded, false if they should operate directly on the JFrame.

Annotations
@BeanProperty
hidden:true
description:Whether the add and setLayout methods are forwarded
See Also
addImpl, setLayout, isRootPaneCheckingEnabled, javax.swing.RootPaneContainer
setTransferHandlerback to summary
public void setTransferHandler(TransferHandler newHandler)

Sets the transferHandler property, which is a mechanism to support transfer of data into this component. Use null if the component does not support data transfer operations.

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

Note

When used with JFrame, TransferHandler only provides data import capability, as the data export related methods are currently typed to JComponent.

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

Parameters
newHandler:TransferHandler

the new TransferHandler

Annotations
@BeanProperty
hidden:true
description:Mechanism for transfer of data into the component
Since
1.6
See Also
TransferHandler, getTransferHandler, java.awt.Component#setDropTarget
updateback to summary
public void update(Graphics g)

Overrides java.awt.Container.update.

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

Parameters
g:Graphics

the Graphics context in which to paint

javax.swing back to summary

protected Class JFrame.AccessibleJFrame

extends AccessibleAWTFrame
Class Inheritance

This class implements accessibility support for the JFrame class. It provides an implementation of the Java Accessibility API appropriate to frame user-interface elements.

Constructor Summary

AccessConstructor and Description
protected
AccessibleJFrame()

Constructs an AccessibleJFrame.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the localized name of the object -- can be null if this object does not have a name
getAccessibleName
()

Overrides java.awt.Component.AccessibleAWTComponent.getAccessibleName.

Get the accessible name of this object.
public AccessibleStateSet

Returns:

an instance of AccessibleStateSet containing the current state set of the object
getAccessibleStateSet
()

Overrides java.awt.Frame.AccessibleAWTFrame.getAccessibleStateSet.

Get the state of this object.
Inherited from java.awt.Frame.AccessibleAWTFrame:
getAccessibleRole

Constructor Detail

AccessibleJFrameback to summary
protected AccessibleJFrame()

Constructs an AccessibleJFrame.

Method Detail

getAccessibleNameback to summary
public String getAccessibleName()

Overrides java.awt.Component.AccessibleAWTComponent.getAccessibleName.

Get the accessible name of this object.

Returns:String

the localized name of the object -- can be null if this object does not have a name

getAccessibleStateSetback to summary
public AccessibleStateSet getAccessibleStateSet()

Overrides java.awt.Frame.AccessibleAWTFrame.getAccessibleStateSet.

Get the state of this object.

Returns:AccessibleStateSet

an instance of AccessibleStateSet containing the current state set of the object

See Also
AccessibleState