Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.Component
java.awt.TextComponent
java.awt.TextArea
Nested Class Summary | |
protected class |
Nested classes/interfaces inherited from class java.awt.TextComponent | |
TextComponent.AccessibleAWTTextComponent |
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent , Component.BltBufferStrategy , Component.FlipBufferStrategy |
Field Summary | |
static int |
|
static int |
|
static int |
|
static int |
|
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 |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH |
Constructor Summary | |
| |
| |
Method Summary | |
void |
|
void | |
void |
|
AccessibleContext |
|
int |
|
Dimension |
|
Dimension |
|
Dimension |
|
Dimension |
|
int |
|
int |
|
void | |
void |
|
Dimension |
|
Dimension |
|
protected String |
|
Dimension |
|
Dimension |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static final int SCROLLBARS_BOTH
Display both horiztonal and vertical scroll bars.
- Field Value:
- 0
public static final int SCROLLBARS_HORIZONTAL_ONLY
Display horizatonal scroll bar only.
- Field Value:
- 2
public static final int SCROLLBARS_VERTICAL_ONLY
Display vertical scroll bar only.
- Field Value:
- 1
public TextArea()
Initialize a new instance ofTextArea
that is empty. Conceptually theTextArea
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
public TextArea(int rows, int columns)
Initialize a new instance ofTextArea
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
public TextArea(String text)
Initialize a new instance ofTextArea
that contains the specified text. Conceptually theTextArea
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 asnull
, it will be set to "".
- Parameters:
text
- The text to display in this text area (null
permitted).
- Throws:
HeadlessException
- if GraphicsEnvironment.isHeadless () is true
public TextArea(String text, int rows, int columns)
Initialize a new instance ofTextArea
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 asnull
, 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
public TextArea(String text, int rows, int columns, int scrollbarVisibility)
Initialize a new instance ofTextArea
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 asnull
, 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
public void append(String str)
Append the specified text to the end of the current text.
- Parameters:
str
- The text to append.
public void appendText(String str)
Deprecated. This method is deprecated in favor of
append ()
.Append the specified text to the end of the current text.
- Parameters:
str
- The text to append.
public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with thisTextArea
. The context is created, if necessary.
- Specified by:
- getAccessibleContext in interface Accessible
- Overrides:
- getAccessibleContext in interface TextComponent
- Returns:
- the associated context
public int getColumns()
Retrieve the number of columns that this text area would prefer to display. This value may or may not correspond to the number of columns that are actually displayed.
- Returns:
- The preferred number of columns.
public Dimension getMinimumSize()
Retrieve the minimum size for this text area.
- Overrides:
- getMinimumSize in interface Component
- Returns:
- The minimum size for this text field.
public Dimension getMinimumSize(int rows, int columns)
Retrieve the minimum size for this text area. If the minimum size has been set, then rows and columns are used in the calculation.
- 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.
public Dimension getPreferredSize()
Retrieve the preferred size for this text area.
- Overrides:
- getPreferredSize in interface Component
- Returns:
- The preferred size for this text field.
public Dimension getPreferredSize(int rows, int columns)
Retrieve the preferred size for this text area. If the preferred size has been set, then rows and columns are used in the calculation.
- 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.
public int getRows()
Retrieve the number of rows that this text area would prefer to display. This value may or may not correspond to the number of rows that are actually displayed.
- Returns:
- The preferred number of rows.
public int getScrollbarVisibility()
Retrieve the scroll bar display policy -- one of SCROLLBARS_BOTH, SCROLLBARS_VERTICAL_ONLY, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE.
- Returns:
- The current scroll bar display policy.
public void insert(String str, int pos)
Insert the specified text at the specified position. The first character in the text area is at position zero.
- Parameters:
str
- The text to insert.pos
- The position at which to insert text.
public void insertText(String str, int pos)
Deprecated. This method is deprecated in favor of
insert ()
.Insert the specified text at the specified position. The first character in the text area is at position zero.
- Parameters:
str
- The text to insert.pos
- The position at which to insert text.
public Dimension minimumSize()
Deprecated. This method is deprecated in favor of
getMinimumSize ()
.Retrieve the minimum size for this text area.
- Overrides:
- minimumSize in interface Component
- Returns:
- The minimum size for this text area.
public Dimension minimumSize(int rows, int columns)
Deprecated. This method is deprecated in favor of
getMinimumSize (int, int)
.Retrieve the minimum size for this text area. If the minimum size has been set, then rows and columns are used in the calculation.
- 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.
protected String paramString()
Retrieve a debugging string for this text area.
- Overrides:
- paramString in interface TextComponent
- Returns:
- A debugging string for this text area.
public Dimension preferredSize()
Deprecated. This method is deprecated in favor of
getPreferredSize ()
.Retrieve the preferred size for this text area.
- Overrides:
- preferredSize in interface Component
- Returns:
- The preferred size for this text field.
public Dimension preferredSize(int rows, int columns)
Deprecated. This method is deprecated in favor of
getPreferredSize (int, int)
.Retrieve the preferred size for this text area. If the preferred size has been set, then rows and columns are used in the calculation.
- 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.
public void replaceRange(String str, int start, int end)
Replace a range of characters with the specified text. The character at the start position will be replaced, unless start == end. The character at the end posistion will not be replaced. The first character in the text area is at position zero. The length of the replacement text may differ from the length of the text that is replaced.
- Parameters:
str
- The new text for the range.start
- The start position of the replacement range.end
- The end position of the replacement range.
public void replaceText(String str, int start, int end)
Deprecated. This method is deprecated in favor of
replaceRange ()
.Replace a range of characters with the specified text. The character at the start position will be replaced, unless start == end. The character at the end posistion will not be replaced. The first character in the text area is at position zero. The length of the replacement text may differ from the length of the text that is replaced.
- Parameters:
str
- The new text for the range.start
- The start position of the replacement range.end
- The end position of the replacement range.
public void setColumns(int columns)
Set the preferred number of columns for this text area. This method does not cause the number of columns displayed by the text area to be updated, if the text area is currently visible.
- Parameters:
columns
- The preferred number of columns.
- Throws:
IllegalArgumentException
- If columns is less than zero.
public void setRows(int rows)
Set the preferred number of rows for this text area. This method does not cause the number of columns displayed by the text area to be updated, if the text area is currently visible.
- Parameters:
rows
- The preferred number of rows.
- Throws:
IllegalArgumentException
- If rows is less than zero.