8.3 Basic RootPaneContainers


For the rest of this chapter, we'll look at some basic containers (JFrame, JWindow, and JApplet) that implement RootPaneContainer and use JRootPane. First, we'll take a quick look at a simple interface called WindowConstants.

8.3.1 The WindowConstants Interface

WindowConstants is a simple interface containing only constants. It is implemented by JFrame, JDialog, and JInternalFrame.

8.3.1.1 Constants

The constants defined in WindowConstants specify possible behaviors in response to a window being closed. These values are shown in Table 8-7.

Table 8-7. JWindowConstants constants

Constant

Type

Description

DISPOSE_ON_CLOSE

int

Disposes window when closed

DO_NOTHING_ON_CLOSE

int

Does nothing when closed

EXIT_ON_CLOSE1.4, *

int

Exits the virtual machine when closed

HIDE_ON_CLOSE

int

Hides window when closed

1.4since 1.4

*This constant was added in 1.4, although a matching constant was defined in the 1.3 JFrame class.

In the next section, we'll look at a strategy for exiting the application in response to a frame being closed .



Java Swing
Graphic Java 2: Mastering the Jfc, By Geary, 3Rd Edition, Volume 2: Swing
ISBN: 0130796670
EAN: 2147483647
Year: 2001
Pages: 289
Authors: David Geary

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net