Online Documentation Server
 ПОИСК
ods.com.ua Web
 КАТЕГОРИИ
Home
Programming
Net technology
Unixes
Security
RFC, HOWTO
Web technology
Data bases
Other docs

 


 ПОДПИСКА

 О КОПИРАЙТАХ
Вся предоставленная на этом сервере информация собрана нами из разных источников. Если Вам кажется, что публикация каких-то документов нарушает чьи-либо авторские права, сообщите нам об этом.




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 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);
 


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 text area.
 o TextArea(int, int)
Constructs a new empty TextArea with the specified number of rows and columns.
 o TextArea(String)
Constructs a new text area with the specified text.
 o TextArea(String, int, int)
Constructs a new text area with the specified text, and with the specified number of rows and columns.
 o TextArea(String, int, int, int)
Constructs a new text area with the specified text, and with the rows, columns, and scroll bar visibility as specified.

Method Index

 o addNotify()
Creates the TextArea's peer.
 o append(String)
Appends the given text to the text area's current text.
 o appendText(String)
Deprecated.
 o getColumns()
Gets the number of columns in this text area.
 o getMinimumSize()
Determines the minimum size of this text area.
 o getMinimumSize(int, int)
Determines the minimum size of a text area with the specified number of rows and columns.
 o getPreferredSize()
Determines the preferred size of this text area.
 o getPreferredSize(int, int)
Determines the preferred size of a text area with the specified number of rows and columns.
 o getRows()
Gets the number of rows in the text area.
 o getScrollbarVisibility()
Gets an enumerated value that indicates which scroll bars the text area uses.
 o insert(String, int)
Inserts the specified text at the specified position in this text area.
 o insertText(String, int)
Deprecated.
 o minimumSize()
Deprecated.
 o minimumSize(int, int)
Deprecated.
 o paramString()
Returns the parameter string representing the state of this text area.
 o preferredSize()
Deprecated.
 o preferredSize(int, int)
Deprecated.
 o replaceRange(String, int, int)
Replaces text between the indicated start and end positions with the specified replacement text.
 o replaceText(String, int, int)
Deprecated.
 o setColumns(int)
Sets the number of columns for this text area.
 o setRows(int)
Sets the number of rows for this text area.

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 text area. This text area is created with both vertical and horizontal scroll bars.

 o TextArea
 public TextArea(String text)
Constructs a new text area with the specified text. This text area is created with both vertical and horizontal scroll bars.

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 text area with the specified text, and with the specified number of rows and columns. This text area is created with both vertical and horizontal scroll bars.

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 text area with the specified text, and with the rows, columns, and scroll bar visibility as specified.

The TextArea class defines several constants that can be supplied as values for the scrollbars argument: SCROLLBARS_BOTH, SCROLLBARS_VERTICAL_ONLY, SCROLLBARS_HORIZONTAL_ONLY, and SCROLLBARS_NEITHER.

Parameters:
text - the text to be displayed.
rows - the number of rows.
columns - the number of columns.
scrollbars - a constant that determines what scrollbars are created to view the text area.

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 in this text area.

Parameters:
str - the text to insert.
pos - the position at which to insert.
See Also:
setText, replaceRange, append
 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 text area's current text.

Parameters:
str - the text to append.
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 between the indicated start and end positions with the specified replacement text.

Parameters:
str - the text to use as the replacement.
start - the start position.
end - the end position.
See Also:
insert
 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()
Gets the number of rows in the text area.

Returns:
the number of rows in the text area.
See Also:
setRows, getColumns
 o setRows
 public void setRows(int rows)
Sets the number of rows for this text area.

Parameters:
rows - the number of rows.
Throws: IllegalArgumentException
if the value supplied for rows is less than zero.
See Also:
getRows, setColumns
 o getColumns
 public int getColumns()
Gets the number of columns in this text area.

Returns:
the number of columns in the text area.
See Also:
setColumns, getRows
 o setColumns
 public void setColumns(int columns)
Sets the number of columns for this text area.

Parameters:
columns - the number of columns.
Throws: IllegalArgumentException
if the value supplied for columns is less than zero.
See Also:
getColumns, setRows
 o getScrollbarVisibility
 public int getScrollbarVisibility()
Gets an enumerated value that indicates which scroll bars the text area uses.

The TextArea class defines four integer constants that are used to specify which scroll bars are available. TextArea has one constructor that gives the application discretion over scroll bars.

Returns:
an integer that indicates which scroll bars are used.
See Also:
SCROLLBARS_BOTH, SCROLLBARS_VERTICAL_ONLY, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NEITHER, TextArea
 o getPreferredSize
 public Dimension getPreferredSize(int rows,
                                   int columns)
Determines the preferred size of a text area with the specified number of rows and columns.

Parameters:
rows - the number of rows.
cols - the number of columns.
Returns:
the preferred dimensions required to display the text area with the specified number of rows and columns.
See Also:
getPreferredSize
 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()
Determines the preferred size of this text area.

Returns:
the preferred dimensions needed for this text area.
Overrides:
getPreferredSize in class Component
See Also:
getPreferredSize
 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)
Determines the minimum size of a text area with the specified number of rows and columns.

Parameters:
rows - the number of rows.
cols - the number of columns.
Returns:
the minimum dimensions required to display the text area with the specified number of rows and columns.
See Also:
getMinimumSize
 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()
Determines the minimum size of this text area.

Returns:
the preferred dimensions needed for this text area.
Overrides:
getMinimumSize in class Component
See Also:
getPreferredSize
 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 parameter string representing the state of this text area. This string is useful for debugging.

Returns:
the parameter string of this text area.
Overrides:
paramString in class TextComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature


With any suggestions or questions please feel free to contact us