|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.TextComponent | +--java.awt.TextArea
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);
Field Summary | |
static int | SCROLLBARS_BOTH
Create and display both vertical and horizontal scrollbars. |
static int | SCROLLBARS_HORIZONTAL_ONLY
Create and display horizontal scrollbar only. |
static int | SCROLLBARS_NONE
Do not create or display any scrollbars for the text area. |
static int | SCROLLBARS_VERTICAL_ONLY
Create and display vertical scrollbar only. |
Fields inherited from class java.awt.TextComponent | |
textListener |
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT |
Constructor Summary | |
TextArea()
Constructs a new text area. |
|
TextArea(int rows,
int columns)
Constructs a new empty TextArea with the specified number of rows and columns. |
|
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. |
|
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. |
|
TextArea(String text)
Constructs a new text area with the specified text. |
Method Summary | |
void | addNotify()
Creates the TextArea's peer. |
void | append(String str)
Appends the given text to the text area's current text. |
void | appendText(String str)
Deprecated. As of JDK version 1.1, replaced by append(String) . |
int | getColumns()
Gets the number of columns in this text area. |
Dimension | getMinimumSize()
Determines the minimum size of this text area. |
Dimension | getMinimumSize(int rows,
int columns)
Determines the minimum size of a text area with the specified number of rows and columns. |
Dimension | getPreferredSize()
Determines the preferred size of this text area. |
Dimension | getPreferredSize(int rows,
int columns)
Determines the preferred size of a text area with the specified number of rows and columns. |
int | getRows()
Gets the number of rows in the text area. |
int | getScrollbarVisibility()
Gets an enumerated value that indicates which scroll bars the text area uses. |
void | insert(String str,
int pos)
Inserts the specified text at the specified position in this text area. |
void | insertText(String str,
int pos)
Deprecated. As of JDK version 1.1, replaced by insert(String, int) . |
Dimension | minimumSize()
Deprecated. As of JDK version 1.1, replaced by getMinimumSize() . |
Dimension | minimumSize(int rows,
int columns)
Deprecated. As of JDK version 1.1, replaced by getMinimumSize(int, int) . |
protected String | paramString()
Returns the parameter string representing the state of this text area. |
Dimension | preferredSize()
Deprecated. As of JDK version 1.1, replaced by getPreferredSize() . |
Dimension | preferredSize(int rows,
int columns)
Deprecated. As of JDK version 1.1, replaced by getPreferredSize(int, int) . |
void | replaceRange(String str,
int start,
int end)
Replaces text between the indicated start and end positions with the specified replacement text. |
void | replaceText(String str,
int start,
int end)
Deprecated. As of JDK version 1.1, replaced by replaceRange(String, int, int) . |
void | setColumns(int columns)
Sets the number of columns for this text area. |
void | setRows(int rows)
Sets the number of rows for this text area. |
Methods inherited from class java.awt.TextComponent | |
addTextListener , getCaretPosition , getSelectedText , getSelectionEnd , getSelectionStart , getText , isEditable , processEvent , processTextEvent , removeNotify , removeTextListener , select , selectAll , setCaretPosition , setEditable , setSelectionEnd , setSelectionStart , setText |
Methods inherited from class java.lang.Object | |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait |
Field Detail |
public static final int SCROLLBARS_BOTH
public static final int SCROLLBARS_VERTICAL_ONLY
public static final int SCROLLBARS_HORIZONTAL_ONLY
public static final int SCROLLBARS_NONE
Constructor Detail |
public TextArea()
public TextArea(String text)
text
- the text to be displayed.public TextArea(int rows, int columns)
rows
- the number of rows
columns
- the number of columnspublic TextArea(String text, int rows, int columns)
text
- the text to be displayed.
rows
- the number of rows.
columns
- the number of columns.public TextArea(String text, int rows, int columns, int scrollbars)
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_NONE
.
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.Method Detail |
public void addNotify()
public void insert(String str, int pos)
str
- the text to insert.
pos
- the position at which to insert.TextComponent.setText(java.lang.String)
,
replaceRange(java.lang.String, int, int)
,
append(java.lang.String)
public void insertText(String str, int pos)
insert(String, int)
.public void append(String str)
str
- the text to append.insert(java.lang.String, int)
public void appendText(String str)
append(String)
.public void replaceRange(String str, int start, int end)
str
- the text to use as the replacement.
start
- the start position.
end
- the end position.insert(java.lang.String, int)
public void replaceText(String str, int start, int end)
replaceRange(String, int, int)
.public int getRows()
setRows(int)
,
getColumns()
public void setRows(int rows)
rows
- the number of rows.rows
is less than zero.getRows()
,
setColumns(int)
public int getColumns()
setColumns(int)
,
getRows()
public void setColumns(int columns)
columns
- the number of columns.columns
is less than zero.getColumns()
,
setRows(int)
public int getScrollbarVisibility()
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.
SCROLLBARS_BOTH
,
SCROLLBARS_VERTICAL_ONLY
,
SCROLLBARS_HORIZONTAL_ONLY
,
SCROLLBARS_NONE
,
TextArea(java.lang.String, int, int, int)
public Dimension getPreferredSize(int rows, int columns)
rows
- the number of rows.
cols
- the number of columns.Component.getPreferredSize()
public Dimension preferredSize(int rows, int columns)
getPreferredSize(int, int)
.public Dimension getPreferredSize()
Component.getPreferredSize()
public Dimension preferredSize()
getPreferredSize()
.public Dimension getMinimumSize(int rows, int columns)
rows
- the number of rows.
cols
- the number of columns.Component.getMinimumSize()
public Dimension minimumSize(int rows, int columns)
getMinimumSize(int, int)
.public Dimension getMinimumSize()
Component.getPreferredSize()
public Dimension minimumSize()
getMinimumSize()
.protected String paramString()
|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |