java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
All Implemented Interfaces:
HasGetTransferHandler, Accessible, RootPaneContainer, WindowConstants, MenuContainer, Serializable, ImageObserver
Direct Known Subclasses:
CWebConnect, ApplicationFrame, Main, ConsoleFrame, MainFrame, CAboutBox, MainFrame, ConsoleAutoDetectProgressFrame, DefaultUI, WiSimMainController, CEditorBox, ConsoleOptionsFrame, BibtexBaseFrame, CBasicFrame, ModemControllerFrame, RebuildDialog, CMapGUI, MainFrame, JBEditJFrame, ConsoleAboutFrame, AppFrame, TestFrame, ConsoleGPSInfoFrame, CBaseClass, ConsoleAutoDetectFrame, Cwlandscape_win
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 .
attribute - : isContainer true
attribute: containerDelegate getContentPane
description: A toplevel window which can be minimized to an icon.Jeff - DinkinsGeorges - SaabDavid - Kloba| 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.
|
| 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.Container: |
|---|
| ncomponents, component, layoutMgr, containerListener, listeningChildren, listeningBoundsChildren, descendantsCount, INCLUDE_SELF, SEARCH_HEAVYWEIGHTS, modalComp, modalAppContext |
| Constructor: |
|---|
This constructor sets the component's locale property to the value
returned by
|
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
|
Frame with the
specified title.
This constructor sets the component's locale property to the value
returned by
|
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
|
| Methods from java.lang.Object: |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from javax.swing.JFrame Detail: |
|---|
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. |
rootPane. |
JFrame properly. |
|
contentPane object for this frame. |
|
glassPane object for this frame. |
|
|
layeredPane object for this frame. |
rootPane object for this frame. |
transferHandler property. |
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. |
add and
setLayout are forwarded to the contentPane. |
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. |
defaultCloseOperation property. |
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. |
time milliseconds. Refer to RepaintManager
for details on how the repaint is handled. |
contentPane property.
This method is called by the constructor.
Swing's painting architecture requires an opaque |
The value is set to 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. |
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); |
glassPane property.
This method is called by the constructor. |
|
|
layeredPane property.
This method is called by the constructor. |
LayoutManager.
Overridden to conditionally forward the call to the
contentPane.
Refer to javax.swing.RootPaneContainer for
more information. |
rootPane property.
This method is called by the constructor. |
add and
setLayout are forwarded to the contentPane. |
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. |
paint(g). This method was overridden to
prevent an unnecessary call to clear the background. |