javax.swing
public class JFrame extends Frame implements WindowConstants, RootPaneContainer, Accessible
java.awt.Frame
s, JFrames support the
Swing Pluggable Look & Feel architecture.
Nested Class Summary | |
---|---|
protected class | JFrame.AccessibleJFrame
Provides accessibility support for JFrame s. |
Field Summary | |
---|---|
protected AccessibleContext | accessibleContext |
static int | EXIT_ON_CLOSE
A flag for {@link #setDefaultCloseOperation(int)}, indicating that the
application should be exited, when this JFrame is closed.
|
protected JRootPane | rootPane |
protected boolean | rootPaneCheckingEnabled |
Constructor Summary | |
---|---|
JFrame()
Creates a new frame with an empty string for the title. | |
JFrame(String title)
Creates a new JFrame with the specified title.
| |
JFrame(GraphicsConfiguration gc)
Creates a new JFrame in the specified {@link GraphicsConfiguration}
and with an empty title.
| |
JFrame(String title, GraphicsConfiguration gc)
Creates a new JFrame in the specified {@link GraphicsConfiguration}
and with the specified title.
|
Method Summary | |
---|---|
protected void | addImpl(Component comp, Object constraints, int index) |
protected JRootPane | createRootPane() |
protected void | frameInit() |
AccessibleContext | getAccessibleContext()
Returns the object that provides accessibility features for this
JFrame .
|
Container | getContentPane() |
int | getDefaultCloseOperation()
Returns a code for the default operation when the frame is closed. |
Component | getGlassPane() |
JMenuBar | getJMenuBar() |
JLayeredPane | getLayeredPane() |
Dimension | getPreferredSize() |
JRootPane | getRootPane() |
static boolean | isDefaultLookAndFeelDecorated() |
protected boolean | isRootPaneCheckingEnabled() |
protected String | paramString()
Returns a string describing the attributes for the JFrame ,
for use in debugging. |
protected void | processKeyEvent(KeyEvent e) |
protected void | processWindowEvent(WindowEvent e) |
void | remove(Component comp) |
void | setContentPane(Container contentPane) |
void | setDefaultCloseOperation(int operation)
Sets the default operation that is performed when this frame is closed.
|
static void | setDefaultLookAndFeelDecorated(boolean decorated) |
void | setGlassPane(Component glassPane) |
void | setJMenuBar(JMenuBar menubar) |
void | setLayeredPane(JLayeredPane layeredPane) |
void | setLayout(LayoutManager manager) |
protected void | setRootPane(JRootPane root) |
protected void | setRootPaneCheckingEnabled(boolean enabled) |
void | update(Graphics g) |
JFrame
is closed.
Note that in version 1.4, the equivalent constant has been added to
{@link WindowConstants}.
Since: 1.3
UNKNOWN: rootPaneCheckingEnabled is false to comply with J2SE 5.0
JFrame
with the specified title.
Parameters: title the frame title (null
permitted).
Parameters: gc the GraphicsConfiguration
that is used for
the new JFrame
See Also: Frame
Parameters: title the title for the new JFrame
gc the GraphicsConfiguration
that is used for
the new JFrame
See Also: Frame
JFrame
.
Returns: The accessible context (an instance of {@link AccessibleJFrame}).
Returns: One of: {@link WindowConstants#DO_NOTHING_ON_CLOSE}, {@link WindowConstants#HIDE_ON_CLOSE}, {@link WindowConstants#DISPOSE_ON_CLOSE}, {@link #EXIT_ON_CLOSE}.
See Also: JFrame
JFrame
,
for use in debugging. The return value is guaranteed to be
non-null
, but the format may vary between implementations.
Returns: A string describing the attributes of the JFrame
.
HIDE_ON_CLOSE
. When
EXIT_ON_CLOSE
is specified this method calls
SecurityManager.checkExit(0)
which might throw a
SecurityException
.
Parameters: operation a code for the operation (one of: {@link WindowConstants#DO_NOTHING_ON_CLOSE}, {@link WindowConstants#HIDE_ON_CLOSE}, {@link WindowConstants#DISPOSE_ON_CLOSE} and {@link WindowConstants#EXIT_ON_CLOSE}).
Throws: IllegalArgumentException if operation
is not one of
the specified codes.
See Also: getDefaultCloseOperation