java::awt::TextArea Class Reference

Inheritance diagram for java::awt::TextArea:

Inheritance graph
java::awt::TextComponentjava::awt::Componentjava::lang::Objectjava::lang::Interfacejava::lang::Syncjava::awt::event::ComponentSourcejava::awt::event::FocusSourcejava::awt::event::HierarchySourcejava::awt::event::KeySourcejava::awt::event::MouseSourcejava::awt::event::PaintSourcejava::util::PropertyChangeSourcejava::awt::event::TextSourcejava::lang::Lockjava::lang::ScopeAdapterjava::awt::image::ImageObserverjava::util::EventSource
[legend]
Collaboration diagram for java::awt::TextArea:

Collaboration graph
java::awt::TextComponentjava::awt::Componentjava::lang::Objectjava::lang::Interfacejava::lang::ObjectRefjava::lang::Syncjava::awt::event::ComponentSourcejava::awt::event::FocusSourcejava::awt::event::HierarchySourcejava::awt::event::KeySourcejava::awt::event::MouseSourcejava::awt::event::PaintSourcejava::util::PropertyChangeSourcejava::awt::event::TextSourcejava::lang::Lockjava::lang::ScopeAdapterjava::lang::Comparablejava::awt::image::ImageObserverjava::util::EventSourcejava::util::Collectionjava::util::LinkedListjava::util::AbstractSequentialListjava::util::AbstractListjava::util::AbstractCollectionjava::util::List
[legend]

List of all members.


Detailed Description

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:

TextArea-1.gif

This text area could be created by the following line of code:


<blockquote>
 new TextArea("Hello", 5, 40);
 
</blockquote>

Version:
1.75, 01/23/03
Author:
Sami Shaio
Since:
JDK1.0

Public Types

enum  SCROLLBAR_VISIBILITY { SCROLLBARS_NONE = 0, SCROLLBARS_HORIZONTAL, SCROLLBARS_VERTICAL, SCROLLBARS_BOTH }

Public Member Functions

 TextArea (const String &text=nilString, jint rows=0, jint columns=0, jint scrollbars=SCROLLBARS_BOTH)
 Constructs a new text area with the specified text, and with the rows, columns, and scroll bar visibility as specified.
virtual void insert (const String &str, jint pos)
 Inserts the specified text at the specified position in this text area.
virtual void append (const String &str)
 Appends the given text to the text area's current text.
virtual void replaceRange (const String &str, jint start=0, jint end=-1)
 Replaces text between the indicated start and end positions with the specified replacement text.
virtual jint getRows () const
 Returns the number of rows in the text area.
virtual void setRows (jint rows)
 Sets the number of rows for this text area.
virtual jint getColumns () const
 Returns the number of columns in this text area.
virtual void setColumns (jint columns)
 Sets the number of columns for this text area.
virtual jint getScrollbarVisibility () const
 Returns an enumerated value that indicates which scroll bars the text area uses.
virtual Dimension getPreferredSize (jint rows=0, jint columns=0) const
 Determines the preferred size of a text area with the specified number of rows and columns.
virtual Dimension getMinimumSize (jint rows=0, jint columns=0) const
 Determines the minimum size of a text area with the specified number of rows and columns.

Protected Attributes

 REGISTER_MEMBERS

Member Enumeration Documentation

enum java::awt::TextArea::SCROLLBAR_VISIBILITY

Enumerator:
SCROLLBARS_NONE  Do not create or display any scrollbars for the text area.

Since:
JDK1.1
SCROLLBARS_HORIZONTAL  Create and display horizontal scrollbar only.

Since:
JDK1.1
SCROLLBARS_VERTICAL  Create and display vertical scrollbar only.

Since:
JDK1.1
SCROLLBARS_BOTH  Create and display both vertical and horizontal scrollbars.

Since:
JDK1.1


Constructor & Destructor Documentation

java::awt::TextArea::TextArea ( const String text = nilString,
jint  rows = 0,
jint  columns = 0,
jint  scrollbars = SCROLLBARS_BOTH 
)

Constructs a new text area with the specified text, and with the rows, columns, and scroll bar visibility as specified.

All TextArea constructors defer to this one.

The TextArea class defines several constants that can be supplied as values for the scrollbars argument:

Any other value for the scrollbars argument is invalid and will result in this text area being created with scrollbar visibility equal to the default value of SCROLLBARS_BOTH.
Parameters:
text the text to be displayed; if text is null, the empty string "" will be displayed
rows the number of rows; if rows is less than 0, rows is set to 0
columns the number of columns; if columns is less than 0, columns is set to 0
scrollbars a constant that determines what scrollbars are created to view the text area
Since:
JDK1.1
Exceptions:
HeadlessException if GraphicsEnvironment.isHeadless returns true
See also:
java.awt.GraphicsEnvironment::isHeadless()


Member Function Documentation

virtual void java::awt::TextArea::insert ( const String str,
jint  pos 
) [virtual]

Inserts the specified text at the specified position in this text area.

Note that passing null or inconsistent parameters is invalid and will result in unspecified behavior.

Parameters:
str the non-null text to insert
pos the position at which to insert
See also:
java.awt.TextComponent::setText

java.awt.TextArea::replaceRange

java.awt.TextArea::append

Since:
JDK1.1

virtual void java::awt::TextArea::append ( const String str  )  [virtual]

Appends the given text to the text area's current text.

Note that passing null or inconsistent parameters is invalid and will result in unspecified behavior.

Parameters:
str the non-null text to append
See also:
java.awt.TextArea::insert
Since:
JDK1.1

virtual void java::awt::TextArea::replaceRange ( const String str,
jint  start = 0,
jint  end = -1 
) [virtual]

Replaces text between the indicated start and end positions with the specified replacement text.

The text at the end position will not be replaced. The text at the start position will be replaced (unless the start position is the same as the end position). The text position is zero-based. The inserted substring may be of a different length than the text it replaces.

Note that passing null or inconsistent parameters is invalid and will result in unspecified behavior.

Parameters:
str the non-null text to use as the replacement
start the start position
end the end position
See also:
java.awt.TextArea::insert
Since:
JDK1.1

virtual jint java::awt::TextArea::getRows (  )  const [virtual]

Returns the number of rows in the text area.

Returns:
the number of rows in the text area
See also:
setRows(int)

getColumns()

Since:
JDK1

virtual void java::awt::TextArea::setRows ( jint  rows  )  [virtual]

Sets the number of rows for this text area.

Parameters:
rows the number of rows
See also:
getRows()

setColumns(int)

Exceptions:
IllegalArgumentException if the value supplied for rows is less than 0
Since:
JDK1.1

virtual jint java::awt::TextArea::getColumns (  )  const [virtual]

Returns the number of columns in this text area.

Returns:
the number of columns in the text area
See also:
setColumns(int)

getRows()

virtual void java::awt::TextArea::setColumns ( jint  columns  )  [virtual]

Sets the number of columns for this text area.

Parameters:
columns the number of columns
See also:
getColumns()

setRows(int)

Exceptions:
IllegalArgumentException if the value supplied for columns is less than 0
Since:
JDK1.1

virtual jint java::awt::TextArea::getScrollbarVisibility (  )  const [virtual]

Returns 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:
java.awt.TextArea::SCROLLBARS_BOTH

java.awt.TextArea::SCROLLBARS_VERTICAL_ONLY

java.awt.TextArea::SCROLLBARS_HORIZONTAL_ONLY

java.awt.TextArea::SCROLLBARS_NONE

java.awt.TextArea::TextArea(java.lang.String, int, int, int)

Since:
JDK1.1

virtual Dimension java::awt::TextArea::getPreferredSize ( jint  rows = 0,
jint  columns = 0 
) const [virtual]

Determines the preferred size of a text area with the specified number of rows and columns.

Parameters:
rows the number of rows
columns the number of columns
Returns:
the preferred dimensions required to display the text area with the specified number of rows and columns
See also:
java.awt.Component::getPreferredSize
Since:
JDK1.1

virtual Dimension java::awt::TextArea::getMinimumSize ( jint  rows = 0,
jint  columns = 0 
) const [virtual]

Determines the minimum size of a text area with the specified number of rows and columns.

Parameters:
rows the number of rows
columns the number of columns
Returns:
the minimum dimensions required to display the text area with the specified number of rows and columns
See also:
java.awt.Component::getMinimumSize
Since:
JDK1.1


Member Data Documentation

java::awt::TextArea::REGISTER_MEMBERS [protected]

Reimplemented from java::awt::TextComponent.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:10 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3