Java Reference
In-Depth Information
protected void frameInit() {
super.frameInit();
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}
■
Caution
If you do override the
frameInit()
method of
JFrame
, remember to call
super.frameInit()
first, to initialize the default behaviors. If you forget and don't reimplement all the default behaviors yourself,
your new frame will look and act differently.
JWindow Class
The
JWindow
class is similar to the
JFrame
class. It uses a
JRootPane
for component management
and implements the
RootPaneContainer
interface. Basically, it is a top-level window with no
adornments.
Creating a JWindow
The
JWindow
class has five constructors:
public JWindow()
JWindow window = new JWindow();
public JWindow(Frame owner)
JWindow window = new JWindow(aFrame);
public JWindow(GraphicsConfiguration config)
GraphicsConfiguration gc = ...;
JWindow window = new JWindow(gc);
public JWindow(Window owner)
JWindow window = new JWindow(anotherWindow);
public JWindow(Window owner, GraphicsConfiguration config)
GraphicsConfiguration gc = ...;
JWindow window = new JWindow(anotherWindow, gc);
You can create a window without specifying a parent or by specifying the parent as a
Frame
or
Window
. If no parent is specified, an invisible one is used.