Java Reference
In-Depth Information
JTextComponent Class
The JTextComponent class is the parent class for all the components used as textual views. It
describes the common behavior shared by all text components. Among other things, this common
behavior includes a Highlighter for selection support, a Caret for navigation throughout the
content, a set of commands supported through the actions property (an array of Action imple-
menters), a set of key bindings through a Keymap or InputMap / ActionMap combination, an
implementation of the Scrollable interface so that each of the specific text components can be
placed within a JScrollPane , and the text stored within the component. If that all sounds like a
lot to manage, don't worry. This chapter will guide you through each of the pieces.
JTextComponent Properties
Table 15-1 shows the 27 properties of JTextComponent . These properties cover the range of
capabilities you would expect from text components.
Table 15-1. JTextComponent Properties
Property Name
Data Type
Access
accessibleContext
AccessibleContext
Read-only
actions
Action[ ]
Read-only
caret
Caret
Read-write bound
caretColor
Color
Read-write bound
caretListeners
CaretListener[ ]
Read-only
caretPosition
int
Read-write
componentOrientation
ComponentOrientation
Write-only bound
disabledTextColor
Color
Read-write bound
document
Document
Read-write bound
dragEnabled
boolean
Read-write
editable
boolean
Read-write bound
focusAccelerator
char
Read-write bound
highlighter
Highlighter
Read-write bound
inputMethodRequests
InputMethodRequests
Read-only
keymap
Keymap
Read-write bound
margin
Insets
Read-write bound
navigationFilter
NavigationFilter
Read-write
preferredScrollableViewportSize
Dimension
Read-only
scrollableTracksViewportHeight
boolean
Read-only
scrollableTracksViewportWidth
boolean
Read-only
Search WWH ::




Custom Search