TextArea object is a multi-line region
that displays text. It can be set to allow editing or
to be read-only.
The following image shows the appearance of a text area:
This text area could be created by the following line of code:
new TextArea("Hello", 5, 40);
| Modifier and Type | Class and Description |
|---|---|
| protected class | TextArea.
This class implements accessibility support for the
|
| Modifier and Type | Field and Description |
|---|---|
| private static Set | backwardTraversalKeys
Cache the Sets of forward and backward traversal keys so we need not look them up each time. |
| private static final String | |
| pack-priv int | columns
The number of columns in the |
| private static Set | forwardTraversalKeys
Cache the Sets of forward and backward traversal keys so we need not look them up each time. |
| private static int | |
| pack-priv int | rows
The number of rows in the |
| public static final int | SCROLLBARS_BOTH
Create and display both vertical and horizontal scrollbars. |
| public static final int | SCROLLBARS_HORIZONTAL_ONLY
Create and display horizontal scrollbar only. |
| public static final int | SCROLLBARS_NONE
Do not create or display any scrollbars for the text area. |
| public static final int | SCROLLBARS_VERTICAL_ONLY
Create and display vertical scrollbar only. |
| private int | scrollbarVisibility
Determines which scrollbars are created for the text area. |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.1 for interoperability.
|
| private int | textAreaSerializedDataVersion
The textArea Serialized Data Version. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | TextArea(int
the number of rows rows, int the number of columns columns)Constructs a new text area with the specified number of rows and columns and the empty string as text. |
| public | |
| public | TextArea(String
the text to be displayed; if
text, int text is null, the empty
string "" will be displayedthe number of rows; if
rows, int rows is less than 0,
rows is set to 0the number of columns; if
columns, int columns is less than 0,
columns is set to 0a constant that determines what
scrollbars are created to view the text area scrollbars)Constructs a new text area with the specified text, and with the rows, columns, and scroll bar visibility as specified. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public synchronized void | appendText(String
the text to append str)
Deprecated
As of JDK version 1.1,
replaced by
append(String).
Appends the given text to the text area's current text. |
| pack-priv String | constructComponentName()
Overrides java. Construct a name for this component. |
| public AccessibleContext | Returns: anAccessibleAWTTextArea that serves as the
AccessibleContext of this TextAreaOverrides java. Implements javax. Returns the |
| public int | Returns: the number of columns in the text areaReturns the number of columns in this text area. |
| public Dimension | Returns: the minimum dimensions required to display the text area with the specified number of rows and columnsthe number of rows rows, int the number of columns columns)Determines the minimum size of a text area with the specified number of rows and columns. |
| public Dimension | Returns: the preferred dimensions needed for this text areaOverrides java. Determines the minimum size of this text area. |
| public Dimension | Returns: the preferred dimensions required to display the text area with the specified number of rows and columnsthe number of rows rows, int the number of columns columns)Determines the preferred size of a text area with the specified number of rows and columns. |
| public Dimension | Returns: the preferred dimensions needed for this text areaOverrides java. Determines the preferred size of this text area. |
| public int | |
| public int | Returns: an integer that indicates which scroll bars are usedReturns an enumerated value that indicates which scroll bars the text area uses. |
| private static native void | |
| public void | |
| public synchronized void | insertText(String
the non- str, int null text to insertthe position at which to insert pos)
Deprecated
As of JDK version 1.1,
replaced by
insert(String, int).
Inserts the specified text at the specified position in this text area. |
| public Dimension | Returns: the minimum size for the text areathe number of rows rows, int the number of columns columns)
Deprecated
As of JDK version 1.1,
replaced by
getMinimumSize(int, int).
Determines the minimum size of the text area with the specified number of rows and columns. |
| public Dimension | minimumSize()
Overrides java.
Deprecated
As of JDK version 1.1,
replaced by
getMinimumSize().
Returns the minimum size of this component. |
| protected String | Returns: the parameter string of this text areaOverrides java. Returns a string representing the state of this |
| public Dimension | Returns: the preferred dimensions needed for the text areathe number of rows rows, int the number of columns columns)
Deprecated
As of JDK version 1.1,
replaced by
getPreferredSize(int, int).
Determines the preferred size of the text area with the specified number of rows and columns. |
| public Dimension | preferredSize()
Overrides java.
Deprecated
As of JDK version 1.1,
replaced by
getPreferredSize().
Returns the component's preferred size. |
| private void | readObject(ObjectInputStream
the s)ObjectInputStream to readHides java. Read the ObjectInputStream. |
| public void | replaceRange(String
the non- str, int null text to use as
the replacementthe start position start, int the end position end)Replaces text between the indicated start and end positions with the specified replacement text. |
| public synchronized void | replaceText(String
the non- str, int null text to use as
the replacementthe start position start, int the end position end)
Deprecated
As of JDK version 1.1,
replaced by
replaceRange(String, int, int).
Replaces a range of characters between the indicated start and end positions with the specified replacement text (the text at the end position will not be replaced). |
| public void | |
| public void |
| backwardTraversalKeys | back to summary |
|---|---|
| private static Set<AWTKeyStroke> backwardTraversalKeys Cache the Sets of forward and backward traversal keys so we need not look them up each time. | |
| base | back to summary |
|---|---|
| private static final String base | |
| columns | back to summary |
|---|---|
| pack-priv int columns The number of columns in the
| |
| forwardTraversalKeys | back to summary |
|---|---|
| private static Set<AWTKeyStroke> forwardTraversalKeys Cache the Sets of forward and backward traversal keys so we need not look them up each time. | |
| nameCounter | back to summary |
|---|---|
| private static int nameCounter | |
| rows | back to summary |
|---|---|
| pack-priv int rows The number of rows in the
| |
| SCROLLBARS_BOTH | back to summary |
|---|---|
| public static final int SCROLLBARS_BOTH Create and display both vertical and horizontal scrollbars.
| |
| SCROLLBARS_HORIZONTAL_ONLY | back to summary |
|---|---|
| public static final int SCROLLBARS_HORIZONTAL_ONLY Create and display horizontal scrollbar only.
| |
| SCROLLBARS_NONE | back to summary |
|---|---|
| public static final int SCROLLBARS_NONE Do not create or display any scrollbars for the text area.
| |
| SCROLLBARS_VERTICAL_ONLY | back to summary |
|---|---|
| public static final int SCROLLBARS_VERTICAL_ONLY Create and display vertical scrollbar only.
| |
| scrollbarVisibility | back to summary |
|---|---|
| private int scrollbarVisibility Determines which scrollbars are created for the
text area. It can be one of four values :
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. Use serialVersionUID from JDK 1.1 for interoperability. | |
| textAreaSerializedDataVersion | back to summary |
|---|---|
| private int textAreaSerializedDataVersion The textArea Serialized Data Version. | |
| TextArea | back to summary |
|---|---|
| public TextArea() throws HeadlessException Constructs a new text area with the empty string as text.
This text area is created with scrollbar visibility equal to
| |
| TextArea | back to summary |
|---|---|
| public TextArea(String text) throws HeadlessException Constructs a new text area with the specified text.
This text area is created with scrollbar visibility equal to
| |
| TextArea | back to summary |
|---|---|
| public TextArea(int rows, int columns) throws HeadlessException Constructs a new text area with the specified number of
rows and columns and the empty string as text.
A column is an approximate average character
width that is platform-dependent. The text area is created with
scrollbar visibility equal to
| |
| TextArea | back to summary |
|---|---|
| public TextArea(String text, int rows, int columns) throws HeadlessException Constructs a new text area with the specified text,
and with the specified number of rows and columns.
A column is an approximate average character
width that is platform-dependent. The text area is created with
scrollbar visibility equal to
| |
| TextArea | back to summary |
|---|---|
| public TextArea(String text, int rows, int columns, int scrollbars) throws HeadlessException Constructs a new text area with the specified text,
and with the rows, columns, and scroll bar visibility
as specified. All
The
scrollbars argument is invalid and will result in
this text area being created with scrollbar visibility equal to
the default value of SCROLLBARS_BOTH.
| |
| addNotify | back to summary |
|---|---|
| public void addNotify() Overrides java. Creates the | |
| append | back to summary |
|---|---|
| public void append(String str) Appends the given text to the text area's current text. Note that passing
| |
| appendText | back to summary |
|---|---|
| public synchronized void appendText(String str)
Deprecated As of JDK version 1.1,
replaced by Appends the given text to the text area's current text.
| |
| constructComponentName | back to summary |
|---|---|
| pack-priv String constructComponentName() Overrides java. Construct a name for this component. Called by | |
| getAccessibleContext | back to summary |
|---|---|
| public AccessibleContext getAccessibleContext() Overrides java. Implements javax. Returns the
| |
| getColumns | back to summary |
|---|---|
| public int getColumns() Returns the number of columns in this text area.
| |
| getMinimumSize | back to summary |
|---|---|
| public Dimension getMinimumSize(int rows, int columns) Determines the minimum size of a text area with the specified number of rows and columns.
| |
| getMinimumSize | back to summary |
|---|---|
| public Dimension getMinimumSize() Overrides java. Determines the minimum size of this text area.
| |
| getPreferredSize | back to summary |
|---|---|
| public Dimension getPreferredSize(int rows, int columns) Determines the preferred size of a text area with the specified number of rows and columns.
| |
| getPreferredSize | back to summary |
|---|---|
| public Dimension getPreferredSize() Overrides java. Determines the preferred size of this text area.
| |
| getRows | back to summary |
|---|---|
| public int getRows() Returns the number of rows in the text area.
| |
| getScrollbarVisibility | back to summary |
|---|---|
| public int getScrollbarVisibility() Returns an enumerated value that indicates which scroll bars the text area uses.
The
| |
| initIDs | back to summary |
|---|---|
| private static native void initIDs() Hides java. Initialize JNI field and method ids | |
| insert | back to summary |
|---|---|
| public void insert(String str, int pos) Inserts the specified text at the specified position in this text area. Note that passing
| |
| insertText | back to summary |
|---|---|
| public synchronized void insertText(String str, int pos)
Deprecated As of JDK version 1.1,
replaced by Inserts the specified text at the specified position in this text area.
| |
| minimumSize | back to summary |
|---|---|
| public Dimension minimumSize(int rows, int columns)
Deprecated As of JDK version 1.1,
replaced by Determines the minimum size of the text area with the specified number of rows and columns.
| |
| minimumSize | back to summary |
|---|---|
| public Dimension minimumSize() Overrides java. Doc from java. Deprecated As of JDK version 1.1,
replaced by Returns the minimum size of this component.
| |
| paramString | back to summary |
|---|---|
| protected String paramString() Overrides java. Returns a string representing the state of this
| |
| preferredSize | back to summary |
|---|---|
| public Dimension preferredSize(int rows, int columns)
Deprecated As of JDK version 1.1,
replaced by Determines the preferred size of the text area with the specified number of rows and columns.
| |
| preferredSize | back to summary |
|---|---|
| public Dimension preferredSize() Overrides java. Doc from java. Deprecated As of JDK version 1.1,
replaced by Returns the component's preferred size.
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException, HeadlessException Hides java. Read the ObjectInputStream.
| |
| replaceRange | back to summary |
|---|---|
| public void replaceRange(String str, int start, int end) Replaces text between the indicated start and end positions with the specified replacement text. The text at the end position will not be replaced. The text at the start position will be replaced (unless the start position is the same as the end position). The text position is zero-based. The inserted substring may be of a different length than the text it replaces. Note that passing
| |
| replaceText | back to summary |
|---|---|
| public synchronized void replaceText(String str, int start, int end)
Deprecated As of JDK version 1.1,
replaced by Replaces a range of characters between the indicated start and end positions with the specified replacement text (the text at the end position will not be replaced).
| |
| setColumns | back to summary |
|---|---|
| public void setColumns(int columns) Sets the number of columns for this text area.
| |
| setRows | back to summary |
|---|---|
| public void setRows(int rows) Sets the number of rows for this text area.
| |
TextArea class. It provides an implementation of the
Java Accessibility API appropriate to text area user-interface elements.
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Hides java. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public AccessibleStateSet | Returns: an instance of AccessibleStateSet describing the states of the objectOverrides java. Gets the state set of this object. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. Use serialVersionUID from JDK 1.3 for interoperability. | |
| AccessibleAWTTextArea | back to summary |
|---|---|
| protected AccessibleAWTTextArea() Constructs an | |
| getAccessibleStateSet | back to summary |
|---|---|
| public AccessibleStateSet getAccessibleStateSet() Overrides java. Gets the state set of this object.
| |