Java Reference
In-Depth Information
JTextArea textArea = new JTextArea();
JScrollPane scrollPane = new JScrollPane(textArea);
content.add(scrollPane);
Figure 15-17 shows how a JTextArea looks within a JScrollPane and outside a JScrollPane . In
the JTextArea not in the JScrollPane , you can't see the text that falls below the bottom screen
border. By design, moving the cursor into that area doesn't cause the content at the top to
move up.
Figure 15-17. A JTextArea without a JScrollPane and one within a JScrollPane
JTextArea Properties
Table 15-10 shows the 12 properties of JTextArea .
Table 15-10. JTextArea Properties
Property Name
Data Type
Access
accessibleContext
AccessibleContext
Read-only
columns
int
Read-write
font
Font
Write-only
lineCount
int
Read-only
lineWrap
boolean
Read-write bound
preferredScrollableViewportSize
Dimension
Read-only
preferredSize
Dimension
Read-only
rows
int
Read-write
scrollableTracksViewportWidth
boolean
Read-only
tabSize
int
Read-write bound
UIClassID
String
Read-only
wrapStyleWord
boolean
Read-write bound
 
Search WWH ::




Custom Search