Java Reference
In-Depth Information
Table 4-2.
JComponent Properties (Continued)
Property Name
Data Type
Component
Access
Container
Access
JComponent
Access
showing
boolean
Read-only
N/A
N/A
size
Dimension
Read-write
N/A
N/A
toolkit
Toolkit
Read-only
N/A
N/A
tooltipText
String
N/A
N/A
Read-write
topLevelAncestor
Container
N/A
N/A
Read-only
transferHandler
TransferHandler
N/A
N/A
Read-write
bound
treeLock
Object
Read-only
N/A
N/A
uiClassID
String
N/A
N/A
Read-only
valid
boolean
Read-only
N/A
N/A
validateRoot
boolean
N/A
N/A
Read-only
verifyInputWhenFocusTarget
boolean
N/A
N/A
Read-write
bound
vetoableChangeListeners
VetoableChangeListener
[ ]
N/A
N/A
Read-only
visible
boolean
Read-write
N/A
Write-only
visibleRect
Rectangle
N/A
N/A
Read-only
width
int
Read-only
N/A
Read-only
x
int
Read-only
N/A
Read-only
y
int
Read-only
N/A
Read-only
■
Note
Additionally, there's a read-only
class
property defined at the
Object
level, the parent of the
Component
class.
Including the properties from the parent hierarchy, approximately 92 properties of
JComponent
exist. As that number indicates, the
JComponent
class is extremely well suited for
visual development. There are roughly ten categories of
JComponent
properties, as described in
the following sections.
Position-Oriented Properties
The
x
and
y
properties define the
location
of the component relative to its
parent
. The
locationOnScreen
is just another location for the component, this time relative to the screen's
origin (the upper-left corner). The
width
and
height
properties define the
size
of the component.
The
visibleRect
property describes the part of the component visible within the
topLevelAncestor
,
whereas the
bounds
property defines the component's area, whether visible or not.