java.awt
public class TextArea extends TextComponent implements Serializable
Nested Class Summary | |
---|---|
protected class | TextArea.AccessibleAWTTextArea |
Field Summary | |
---|---|
static int | SCROLLBARS_BOTH
Display both horiztonal and vertical scroll bars. |
static int | SCROLLBARS_HORIZONTAL_ONLY
Display horizatonal scroll bar only. |
static int | SCROLLBARS_NONE
Do not display scrollbars. |
static int | SCROLLBARS_VERTICAL_ONLY
Display vertical scroll bar only. |
Constructor Summary | |
---|---|
TextArea()
Initialize a new instance of TextArea that is empty.
| |
TextArea(String text)
Initialize a new instance of TextArea that contains
the specified text. | |
TextArea(int rows, int columns)
Initialize a new instance of TextArea that is empty
and can display the specified number of rows and columns of text,
without the need to scroll. | |
TextArea(String text, int rows, int columns)
Initialize a new instance of TextArea that can
display the specified number of rows and columns of text, without
the need to scroll. | |
TextArea(String text, int rows, int columns, int scrollbarVisibility)
Initialize a new instance of TextArea that initially
contains the specified text. |
Method Summary | |
---|---|
void | addNotify()
Notify this object that it should create its native peer. |
void | append(String str)
Append the specified text to the end of the current text.
|
void | appendText(String str)
Append the specified text to the end of the current text.
|
AccessibleContext | getAccessibleContext()
Gets the AccessibleContext associated with this TextArea .
|
int | getColumns()
Retrieve the number of columns that this text area would prefer
to display. |
Dimension | getMinimumSize()
Retrieve the minimum size for this text area.
|
Dimension | getMinimumSize(int rows, int columns)
Retrieve the minimum size for this text area. |
Dimension | getPreferredSize()
Retrieve the preferred size for this text area.
|
Dimension | getPreferredSize(int rows, int columns)
Retrieve the preferred size for this text area. |
int | getRows()
Retrieve the number of rows that this text area would prefer to
display. |
int | getScrollbarVisibility()
Retrieve the scroll bar display policy -- one of SCROLLBARS_BOTH,
SCROLLBARS_VERTICAL_ONLY, SCROLLBARS_HORIZONTAL_ONLY,
SCROLLBARS_NONE.
|
void | insert(String str, int pos)
Insert the specified text at the specified position. |
void | insertText(String str, int pos)
Insert the specified text at the specified position. |
Dimension | minimumSize()
Retrieve the minimum size for this text area.
|
Dimension | minimumSize(int rows, int columns)
Retrieve the minimum size for this text area. |
protected String | paramString()
Retrieve a debugging string for this text area.
|
Dimension | preferredSize()
Retrieve the preferred size for this text area.
|
Dimension | preferredSize(int rows, int columns)
Retrieve the preferred size for this text area. |
void | replaceRange(String str, int start, int end)
Replace a range of characters with the specified text. |
void | replaceText(String str, int start, int end)
Replace a range of characters with the specified text. |
void | setColumns(int columns)
Set the preferred number of columns for this text area. |
void | setRows(int rows)
Set the preferred number of rows for this text area. |
TextArea
that is empty.
Conceptually the TextArea
has 0 rows and 0 columns
but its initial bounds are defined by its peer or by the
container in which it is packed. Both horizontal and vertical
scrollbars will be displayed.
Throws: HeadlessException if GraphicsEnvironment.isHeadless () is true
TextArea
that contains
the specified text. Conceptually the TextArea
has 0
rows and 0 columns but its initial bounds are defined by its peer
or by the container in which it is packed. Both horizontal and
veritcal scrollbars will be displayed. The TextArea initially contains
the specified text. If text specified as null, it will
be set to "".
Parameters: text The text to display in this text area (null
permitted).
Throws: HeadlessException if GraphicsEnvironment.isHeadless () is true
TextArea
that is empty
and can display the specified number of rows and columns of text,
without the need to scroll. Both horizontal and vertical
scrollbars will be displayed.
Parameters: rows The number of rows in this text area. columns The number of columns in this text area.
Throws: HeadlessException if GraphicsEnvironment.isHeadless () is true
TextArea
that can
display the specified number of rows and columns of text, without
the need to scroll. The TextArea initially contains the
specified text. If text specified as null, it will
be set to "".
Parameters: text The text to display in this text area (null
permitted). rows The number of rows in this text area. columns The number of columns in this text area.
Throws: HeadlessException if GraphicsEnvironment.isHeadless () is true
TextArea
that initially
contains the specified text. The TextArea can display the
specified number of rows and columns of text, without the need to
scroll. This constructor allows specification of the scroll bar
display policy. The TextArea initially contains the specified text.
If text specified as null, it will be set to "".
Parameters: text The text to display in this text area (null
permitted). rows The number of rows in this text area. columns The number of columns in this text area. scrollbarVisibility The scroll bar display policy. One of
SCROLLBARS_BOTH, SCROLLBARS_VERTICAL_ONLY,
SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE.
Throws: HeadlessException if GraphicsEnvironment.isHeadless () is true
Parameters: str The text to append.
Deprecated: This method is deprecated in favor of
append ()
.
Parameters: str The text to append.
TextArea
.
The context is created, if necessary.
Returns: the associated context
Returns: The preferred number of columns.
Returns: The minimum size for this text field.
Parameters: rows The number of rows to use in the minimum size calculation. columns The number of columns to use in the minimum size calculation.
Returns: The minimum size for this text area.
Returns: The preferred size for this text field.
Parameters: rows The number of rows to use in the preferred size calculation. columns The number of columns to use in the preferred size calculation.
Returns: The preferred size for this text area.
Returns: The preferred number of rows.
Returns: The current scroll bar display policy.
Parameters: str The text to insert. pos The position at which to insert text.
Deprecated: This method is deprecated in favor of
insert ()
.
Parameters: str The text to insert. pos The position at which to insert text.
Deprecated: This method is deprecated in favor of
getMinimumSize ()
.
Returns: The minimum size for this text area.
Deprecated: This method is deprecated in favor of
getMinimumSize (int, int)
.
Parameters: rows The number of rows to use in the minimum size calculation. columns The number of columns to use in the minimum size calculation.
Returns: The minimum size for this text area.
Returns: A debugging string for this text area.
Deprecated: This method is deprecated in favor of
getPreferredSize ()
.
Returns: The preferred size for this text field.
Deprecated: This method is deprecated in favor of
getPreferredSize (int, int)
.
Parameters: rows The number of rows to use in the preferred size calculation. columns The number of columns to use in the preferred size calculation.
Returns: The preferred size for this text area.
Parameters: str The new text for the range. start The start position of the replacement range. end The end position of the replacement range.
Deprecated: This method is deprecated in favor of
replaceRange ()
.
Parameters: str The new text for the range. start The start position of the replacement range. end The end position of the replacement range.
Parameters: columns The preferred number of columns.
Throws: IllegalArgumentException If columns is less than zero.
Parameters: rows The preferred number of rows.
Throws: IllegalArgumentException If rows is less than zero.