Java Reference
In-Depth Information
Component-Set-Oriented Properties
The
components
and
componentCount
properties enable you to find out what the children
components are of the particular
JComponent
. For each component in the
components
property
array, the current component would be its
parent
. In addition to determining a component's
parent
, you can find out its
rootPane
or
topLevelAncestor
.
Focus-Oriented Properties
The
focusable
,
focusCycleRoot
,
focusCycleRootAncestor
,
focusOwner
,
focusTraversalKeysEnabled
,
focusTraversalPolicy
,
focusTraversalPolicyProvider
,
focusTraversablePolicySet
,
requestFocusEnabled
,
verifyInputWhenFocusTarget
, and
inputVerifier
properties define the
set of focus-oriented properties. These properties control the focus behavior of
JComponent
and
were discussed in Chapter 2.
Layout-Oriented Properties
The
alignmentX
,
alignmentY
,
componentOrientation
,
layout
,
maximumSize
,
minimumSize
,
preferredSize
,
maximumSizeSet
,
minimumSizeSet
, and
preferredSizeSet
properties are
used to help with layout management.
Painting Support Properties
The
background
and
foreground
properties describe the current drawing colors. The
font
property
describes the text style to draw. The
backgroundSet
,
foregroundSet
, and
fontSet
properties
describe if the properties are explicitly set. The
insets
and
border
properties are intermixed
to describe the drawing of a border around a component. The
graphics
property permits real-
time drawing, although the
paintImmediately()
method might now suffice.
To improve performance, there are the
opaque
(
false
is transparent),
doubleBuffered
,
ignoreRepaint
, and
optimizedDrawingEnabled
properties. The
colorModel
and
paintingTile
properties store intermediate drawing information. The
graphicsConfiguration
property adds
support for virtual devices.
debugGraphicsOption
allows you to slow down the drawing of your component if you can't
figure out why it's not painted properly. The
debugGraphicsOption
property is set to one or
more of the settings shown in Table 4-3.
Table 4-3.
DebugGraphics Settings
DebugGraphics Settings
Description
DebugGraphics.BUFFERED_OPTION
Causes a window to pop up, displaying the drawing of
the double-buffered image
DebugGraphics.FLASH_OPTION
Causes the drawing to be done more slowly, flashing
between steps
DebugGraphics.LOG_OPTION
Causes a message to be printed to the screen as each
step is done
DebugGraphics.NONE_OPTION
Disables all options