Java >
Guidelines Home Page >  Java Look and Feel Design Guidelines
Part III: The Components of the Java Foundation Classes
> 11: Text Components >
Text Areas
  Previous Next Contents/Index/Search

Text Areas

A text area provides a rectangular space in which users can view, type, and edit multiple lines of text. The JFC renders such text in a single font, size, and style, as shown in the following figure.

Figure 179   Text Area


Text Area

Users can type and replace text in a text area. See Text Fields for a description of text-editing features supplied by the JFC. For keyboard operations appropriate to text areas, see Table 28.

You can enable word wrap so that the text wraps to the next line when it reaches the edge of the text area, as shown in the preceding figure. You can enable scrolling by placing the text area inside a scroll pane. In this case, the text scrolls horizontally or vertically when it is too long to fit in the text area.

The following figure shows a text area inside a scroll pane. For information on scrolling, see Scroll Panes.

Figure 180   Text Area in a Scroll Pane


Text Area in Scroll Pane

  If you place text in a scroll pane, ensure that the vertical scrollbar is always there and provide a horizontal scrollbar only as needed. This is not the default behavior of scroll panes.

  If the text area contains prose, enable word wrap. If the text area contains information for which exact line breaks are important, such as code or poetry, enable horizontal scrolling.

  The lineWrap and wrapStyleWord properties of the text area can be set to true to enable word wrap on word boundaries.

Java Look and Feel Design Guidelines, second edition.
Copyright 2001. Sun Microsystems, Inc. All Rights Reserved.
Previous Next Contents/Index/Search
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
Java 8 banner (182)