All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.TextArea

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.TextComponent
                   |
                   +----java.awt.TextArea

public class TextArea
extends TextComponent
A TextArea object is a multi-line area that displays text. It can be set to allow editing or read-only modes.


Variable Index

 o SCROLLBARS_BOTH
Create and display both vertical and horizontal scrollbars.
 o SCROLLBARS_HORIZONTAL_ONLY
Create and display horizontal scrollbar only.
 o SCROLLBARS_NONE
Do not create or display any scrollbars for the text area.
 o SCROLLBARS_VERTICAL_ONLY
Create and display vertical scrollbar only.

Constructor Index

 o TextArea()
Constructs a new TextArea.
 o TextArea(int, int)
Constructs a new empty TextArea with the specified number of rows and columns.
 o TextArea(String)
Constructs a new TextArea with the specified text displayed.
 o TextArea(String, int, int)
Constructs a new TextArea with the specified text and number of rows and columns.
 o TextArea(String, int, int, int)
Constructs a new TextArea with the specified text and number of rows, columns, and scrollbar visibility.

Method Index

 o addNotify()
Creates the TextArea's peer.
 o append(String)
Appends the given text to the end.
 o appendText(String)
Deprecated.
 o getColumns()
Returns the number of columns in the TextArea.
 o getMinimumSize()
Returns the minimum size Dimensions of the TextArea.
 o getMinimumSize(int, int)
Returns the specified minimum size Dimensions of the TextArea.
 o getPreferredSize()
Returns the preferred size Dimensions of the TextArea.
 o getPreferredSize(int, int)
Returns the specified row and column Dimensions of the TextArea.
 o getRows()
Returns the number of rows in the TextArea.
 o getScrollbarVisibility()
Returns the enumerated value describing which scrollbars the text area has.
 o insert(String, int)
Inserts the specified text at the specified position.
 o insertText(String, int)
Deprecated.
 o minimumSize()
Deprecated.
 o minimumSize(int, int)
Deprecated.
 o paramString()
Returns the String of parameters for this TextArea.
 o preferredSize()
Deprecated.
 o preferredSize(int, int)
Deprecated.
 o replaceRange(String, int, int)
Replaces text from the indicated start to end position with the new text specified.
 o replaceText(String, int, int)
Deprecated.
 o setColumns(int)
Sets the number of columns for this TextArea.
 o setRows(int)
Sets the number of rows for this TextArea.

Variables

 o SCROLLBARS_BOTH
 public static final int SCROLLBARS_BOTH
Create and display both vertical and horizontal scrollbars.

 o SCROLLBARS_VERTICAL_ONLY
 public static final int SCROLLBARS_VERTICAL_ONLY
Create and display vertical scrollbar only.

 o SCROLLBARS_HORIZONTAL_ONLY
 public static final int SCROLLBARS_HORIZONTAL_ONLY
Create and display horizontal scrollbar only.

 o SCROLLBARS_NONE
 public static final int SCROLLBARS_NONE
Do not create or display any scrollbars for the text area.

Constructors

 o TextArea
 public TextArea()
Constructs a new TextArea.

 o TextArea
 public TextArea(String text)
Constructs a new TextArea with the specified text displayed.

Parameters:
text - the text to be displayed
 o TextArea
 public TextArea(int rows,
                 int columns)
Constructs a new empty TextArea with the specified number of rows and columns.

Parameters:
rows - the number of rows
columns - the number of columns
 o TextArea
 public TextArea(String text,
                 int rows,
                 int columns)
Constructs a new TextArea with the specified text and number of rows and columns.

Parameters:
text - the text to be displayed
rows - the number of rows
columns - the number of columns
 o TextArea
 public TextArea(String text,
                 int rows,
                 int columns,
                 int scrollbars)
Constructs a new TextArea with the specified text and number of rows, columns, and scrollbar visibility.

Parameters:
text - the text to be displayed
rows - the number of rows
columns - the number of columns
scrollbars - the visibility of scrollbars

Methods

 o addNotify
 public void addNotify()
Creates the TextArea's peer. The peer allows us to modify the appearance of the TextArea without changing any of its functionality.

Overrides:
addNotify in class Component
 o insert
 public synchronized void insert(String str,
                                 int pos)
Inserts the specified text at the specified position.

Parameters:
str - the text to insert.
pos - the position at which to insert.
See Also:
setText, replaceRange
 o insertText
 public void insertText(String str,
                        int pos)
Note: insertText() is deprecated. As of JDK version 1.1, replaced by insert(String, int).

 o append
 public synchronized void append(String str)
Appends the given text to the end.

Parameters:
str - the text to insert
See Also:
insert
 o appendText
 public void appendText(String str)
Note: appendText() is deprecated. As of JDK version 1.1, replaced by append(String).

 o replaceRange
 public synchronized void replaceRange(String str,
                                       int start,
                                       int end)
Replaces text from the indicated start to end position with the new text specified.

Parameters:
str - the text to use as the replacement.
start - the start position.
end - the end position.
See Also:
insert, replaceRange
 o replaceText
 public void replaceText(String str,
                         int start,
                         int end)
Note: replaceText() is deprecated. As of JDK version 1.1, replaced by replaceRange(String, int, int).

 o getRows
 public int getRows()
Returns the number of rows in the TextArea.

 o setRows
 public void setRows(int rows)
Sets the number of rows for this TextArea.

Parameters:
rows - the number of rows
Throws: IllegalArgumentException
If rows is less than 0.
 o getColumns
 public int getColumns()
Returns the number of columns in the TextArea.

 o setColumns
 public void setColumns(int columns)
Sets the number of columns for this TextArea.

Parameters:
columns - the number of columns
Throws: IllegalArgumentException
If columns is less than 0.
 o getScrollbarVisibility
 public int getScrollbarVisibility()
Returns the enumerated value describing which scrollbars the text area has.

Returns:
the display policy for the scrollbars
 o getPreferredSize
 public Dimension getPreferredSize(int rows,
                                   int columns)
Returns the specified row and column Dimensions of the TextArea.

Parameters:
rows - the preferred rows amount
columns - the preferred columns amount
 o preferredSize
 public Dimension preferredSize(int rows,
                                int columns)
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize(int, int).

 o getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred size Dimensions of the TextArea.

Overrides:
getPreferredSize in class Component
 o preferredSize
 public Dimension preferredSize()
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize().

Overrides:
preferredSize in class Component
 o getMinimumSize
 public Dimension getMinimumSize(int rows,
                                 int columns)
Returns the specified minimum size Dimensions of the TextArea.

Parameters:
rows - the minimum row size
columns - the minimum column size
 o minimumSize
 public Dimension minimumSize(int rows,
                              int columns)
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize(int, int).

 o getMinimumSize
 public Dimension getMinimumSize()
Returns the minimum size Dimensions of the TextArea.

Overrides:
getMinimumSize in class Component
 o minimumSize
 public Dimension minimumSize()
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize().

Overrides:
minimumSize in class Component
 o paramString
 protected String paramString()
Returns the String of parameters for this TextArea.

Overrides:
paramString in class TextComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature