
 |
Chapter 19 java.awt Reference |
 |
TextArea
Name
TextArea
The TextArea class provides
a multi-line Component for
textual user input.
public class java.awt.TextArea
extends java.awt.TextComponent {
// Constants
public final static int SCROLLBARS_BOTH;
public final static int SCROLLBARS_HORIZONTAL_ONLY;
public final static int SCROLLBARS_NONE;
public final static int SCROLLBARS_VERTICAL_ONLY;
// Constructors
public TextArea();
public TextArea (int rows, int columns);
public TextArea (String text);
public TextArea (String text, int rows, int columns);
public TextArea (String text, int rows, int columns, int scrollbars);
// Instance Methods
public void addNotify();
public synchronized void append (String string);
public void appendText (String string);
public int getColumns();
public Dimension getMinimumSize();
public Dimension getMinimumSize (int rows, int columns);
public Dimension getPreferredSize();
public Dimension getPreferredSize (int rows, int columns);
public int getRows();
public int getScrollbarVisibility();
public synchronized void insert (String string, int position);
public void insertText (String string, int position);
public Dimension minimumSize();
public Dimension minimumSize (int rows, int columns);
public Dimension preferredSize();
public Dimension preferredSize (int rows, int columns);
public synchronized void replaceRange (String str, int start, int end);
public void replaceText (String string, int startPosition, int endPosition);
public void setColumns (int columns);
public void setRows (int rows);
// Protected Instance Methods
protected String paramString();
}
Show both the horizontal and vertical scrollbars.
Show the horizontal scrollbar.
Show the vertical scrollbar.
- Description
-
Constructs a TextArea object
with the default size and no initial content. The default size of a text
area varies widely from platform to platform, so it's best to avoid
this constructor.
- Parameters
-
- rows
-
Requested number of displayed rows.
- columns
-
Requested number of displayed columns.
- Description
-
Constructs a TextArea object
of the given size and no initial content.
- Parameters
-
- text
-
Initial text for TextArea.
- Description
-
Constructs a TextArea object
with the given initial content.
- Parameters
-
- text
-
Initial text for TextArea.
- rows
-
Requested number of displayed rows.
- columns
-
Requested number of displayed columns.
- Description
-
Constructs a TextArea object
with the given content and size.
- Parameters
-
- text
-
Initial text for TextArea.
- rows
-
Requested number of displayed rows.
- columns
-
Requested number of displayed columns.
- scrollbars
-
Requested scrollbar visibility. Use one of the constants
defined.
- Description
-
Constructs a TextArea object
with the given content, size, and scrollbar visibility.
- Overrides
-
Component.addNotify()
- Description
-
Creates TextArea's peer.
- Parameters
-
- string
-
Content to append to the end of the TextArea.
- Description
-
Appends the given text string to the text already displayed in the TextArea.
- Parameters
-
- string
-
Content to append to end of TextArea.
- Description
-
Replaced by append(String).
- Returns
-
The width of the TextArea in
columns.
- Returns
-
The minimum dimensions of the TextArea.
- Parameters
-
- rows
-
Number of rows within TextArea
to size.
- columns
-
Number of columns within TextArea
to size.
- Returns
-
The minimum dimensions of a TextArea
of the given size.
- Returns
-
The preferred dimensions of the TextArea.
- Parameters
-
- rows
-
Number of rows within TextArea
to size.
- columns
-
Number of columns within TextArea
to size.
- Returns
-
The preferred dimensions of a TextArea
of the given size.
- Returns
-
The height of the TextArea
in rows.
- Returns
-
One of the SCROLLBAR_ constants
indicating which scrollbars are visible.
- Parameters
-
- string
-
Content to place within TextArea
content.
- position
-
Location to insert content.
- Description
-
Places additional text within the TextArea
at the given position.
- Parameters
-
- string
-
Content to place within TextArea
content.
- position
-
Location to insert content.
- Description
-
Places additional text within the TextArea
at the given position. Replaced by insert(String, int).
- Returns
-
The minimum dimensions of the TextArea.
Replaced by getMinimumSize().
- Parameters
-
- rows
-
Number of rows within TextArea
to size.
- columns
-
Number of columns within TextArea
to size.
- Returns
-
The minimum dimensions of a TextArea
of the given size. Replaced by getMinimumSize(int, int).
- Returns
-
The preferred dimensions of the TextArea.
Replaced by getPreferredSize().
- Parameters
-
- rows
-
Number of rows within TextArea
to size.
- columns
-
Number of columns within TextArea
to size.
- Returns
-
The preferred dimensions of a TextArea
of the given size. Replaced by getPreferredSize(int,
int).
- Parameters
-
- str
-
New content to place in TextArea.
- start
-
Starting position of content to replace.
- end
-
Ending position of content to replace.
- Description
-
Replaces a portion of the TextArea's
content with the given text.
- Parameters
-
- string
-
New content to place in TextArea.
- startPosition
-
Starting position of content to replace.
- endPosition
-
Ending position of content to replace.
- Description
-
Replaces a portion of the TextArea's
content with the given text. Replaced by replaceRange(String,
int, int).
- Parameters
-
- columns
-
New number of columns.
- Throws
-
- IllegalArgumentException
-
If
columns is less than zero.
- Description
-
Changes the number of columns.
- Parameters
-
- rows
-
New number of columns.
- Throws
-
- IllegalArgumentException
-
If
rows is less than zero.
- Description
-
Changes the number of rows.
- Returns
-
String with current settings of TextArea.
- Overrides
-
TextComponent.paramString()
- Description
-
Helper method for toString()
to generate string of current settings.
Dimension, TextComponent,
String
|