Java Reference
In-Depth Information
Table 8-9.
JInternalFrame Properties (Continued)
Property Name
Data Type
Access
layout
LayoutManager
Write-only
maximizable
boolean
Read-write bound
maximum
boolean
Read-write bound constrained
mostRecentFocusOwner
Component
Read-only
normalBounds
Rectangle
Read-write
resizable
boolean
Read-write bound
rootPane
JRootPane
Read-only bound
selected
boolean
Read-write bound constrained
title
String
Read-write bound
UI
InternalFrameUI
Read-write
UIClassID
String
Read-only
warningString
String
Read-only
The initial
defaultCloseOperation
property setting for a
JInternalFrame
is
DISPOSE_ON_CLOSE
for Java 1.3 releases and later. Earlier releases had a default setting of
HIDE_ON_CLOSE
. You can
set this property to any of the
WindowConstants
settings shown earlier in Table 8-6.
The
normalBounds
property describes where an iconified internal frame would appear
when deiconified. The
focusOwner
property provides the actual
Component
with the input focus
when the specific
JInternalFrame
is active.
The
JInternalFrame
contains the only four constrained properties within the Swing classes:
closed
,
icon
,
maximum
, and
selected
. They're directly related to the four
boolean
constructor
parameters. Each allows you to check on the current state of the property as well as change its
setting. However, because the properties are constrained, whenever you try to set one, the
attempt must be in a
try-catch
block, catching
PropertyVetoException
:
try {
// Try to iconify internal frame
internalFrame.setIcon(false);
} catch (PropertyVetoException propertyVetoException) {
System.out.println("Rejected");
}
To help you work with some of the bound properties, the
JInternalFrame
class defines
11 constants, as listed in Table 8-10. They represent the string that should be returned by
getPropertyName()
for a
PropertyChangeEvent
within a
PropertyChangeListener
.