public class

TextArea

extends TextBoxBase
java.lang.Object
   ↳ com.google.gwt.user.client.ui.UIObject
     ↳ com.google.gwt.user.client.ui.Widget
       ↳ com.google.gwt.user.client.ui.FocusWidget
         ↳ com.google.gwt.user.client.ui.ValueBoxBase<T>
           ↳ com.google.gwt.user.client.ui.TextBoxBase
             ↳ com.google.gwt.user.client.ui.TextArea

Class Overview

A text box that allows multiple lines of text to be entered.

CSS Style Rules

  • .gwt-TextArea { primary style }
  • .gwt-TextArea-readonly { dependent style set when the text area is read-only }

Built-in Bidi Text Support

This widget is capable of automatically adjusting its direction according to the input text. This feature is controlled by setDirectionEstimator(boolean), and is available by default when at least one of the application's locales is right-to-left.

Example

{@example com.google.gwt.examples.TextBoxExample}

Summary

[Expand]
Inherited Constants
From class com.google.gwt.user.client.ui.UIObject
[Expand]
Inherited Fields
From class com.google.gwt.user.client.ui.TextBoxBase
Public Constructors
TextArea()
Creates an empty text area.
Protected Constructors
TextArea(Element element)
This constructor may be used by subclasses to explicitly use an existing element.
Public Methods
int getCharacterWidth()
Gets the requested width of the text box (this is not an exact value, as not all characters are created equal).
int getCursorPos()
Gets the current position of the cursor (this also serves as the beginning of the text selection).
int getSelectionLength()
Gets the length of the current text selection.
int getVisibleLines()
Gets the number of text lines that are visible.
void setCharacterWidth(int width)
Sets the requested width of the text box (this is not an exact value, as not all characters are created equal).
void setVisibleLines(int lines)
Sets the number of text lines that are visible.
static TextArea wrap(Element element)
Creates a TextArea widget that wraps an existing <textarea> element.
[Expand]
Inherited Methods
From class com.google.gwt.user.client.ui.TextBoxBase
From class com.google.gwt.user.client.ui.ValueBoxBase
From class com.google.gwt.user.client.ui.FocusWidget
From class com.google.gwt.user.client.ui.Widget
From class com.google.gwt.user.client.ui.UIObject
From class java.lang.Object
From interface com.google.gwt.editor.client.IsEditor
From interface com.google.gwt.event.dom.client.HasBlurHandlers
From interface com.google.gwt.event.dom.client.HasChangeHandlers
From interface com.google.gwt.event.dom.client.HasClickHandlers
From interface com.google.gwt.event.dom.client.HasDoubleClickHandlers
From interface com.google.gwt.event.dom.client.HasFocusHandlers
From interface com.google.gwt.event.dom.client.HasGestureChangeHandlers
From interface com.google.gwt.event.dom.client.HasGestureEndHandlers
From interface com.google.gwt.event.dom.client.HasGestureStartHandlers
From interface com.google.gwt.event.dom.client.HasKeyDownHandlers
From interface com.google.gwt.event.dom.client.HasKeyPressHandlers
From interface com.google.gwt.event.dom.client.HasKeyUpHandlers
From interface com.google.gwt.event.dom.client.HasMouseDownHandlers
From interface com.google.gwt.event.dom.client.HasMouseMoveHandlers
From interface com.google.gwt.event.dom.client.HasMouseOutHandlers
From interface com.google.gwt.event.dom.client.HasMouseOverHandlers
From interface com.google.gwt.event.dom.client.HasMouseUpHandlers
From interface com.google.gwt.event.dom.client.HasMouseWheelHandlers
From interface com.google.gwt.event.dom.client.HasTouchCancelHandlers
From interface com.google.gwt.event.dom.client.HasTouchEndHandlers
From interface com.google.gwt.event.dom.client.HasTouchMoveHandlers
From interface com.google.gwt.event.dom.client.HasTouchStartHandlers
From interface com.google.gwt.event.logical.shared.HasAttachHandlers
From interface com.google.gwt.event.logical.shared.HasValueChangeHandlers
From interface com.google.gwt.event.shared.HasHandlers
From interface com.google.gwt.i18n.client.HasDirection
From interface com.google.gwt.i18n.shared.HasDirectionEstimator
From interface com.google.gwt.user.client.EventListener
From interface com.google.gwt.user.client.TakesValue
From interface com.google.gwt.user.client.ui.Focusable
From interface com.google.gwt.user.client.ui.HasEnabled
From interface com.google.gwt.user.client.ui.HasName
From interface com.google.gwt.user.client.ui.HasText
From interface com.google.gwt.user.client.ui.HasValue
From interface com.google.gwt.user.client.ui.IsWidget
From interface com.google.gwt.user.client.ui.SourcesChangeEvents
From interface com.google.gwt.user.client.ui.SourcesClickEvents
From interface com.google.gwt.user.client.ui.SourcesFocusEvents
From interface com.google.gwt.user.client.ui.SourcesKeyboardEvents
From interface com.google.gwt.user.client.ui.SourcesMouseEvents

Public Constructors

public TextArea ()

Creates an empty text area.

Protected Constructors

protected TextArea (Element element)

This constructor may be used by subclasses to explicitly use an existing element. This element must be a <textarea> element.

Parameters
element the element to be used

Public Methods

public int getCharacterWidth ()

Gets the requested width of the text box (this is not an exact value, as not all characters are created equal).

Returns
  • the requested width, in characters

public int getCursorPos ()

Gets the current position of the cursor (this also serves as the beginning of the text selection).

Returns
  • the cursor's position

public int getSelectionLength ()

Gets the length of the current text selection.

Returns
  • the text selection length

public int getVisibleLines ()

Gets the number of text lines that are visible.

Returns
  • the number of visible lines

public void setCharacterWidth (int width)

Sets the requested width of the text box (this is not an exact value, as not all characters are created equal).

Parameters
width the requested width, in characters

public void setVisibleLines (int lines)

Sets the number of text lines that are visible.

Parameters
lines the number of visible lines

public static TextArea wrap (Element element)

Creates a TextArea widget that wraps an existing <textarea> element. This element must already be attached to the document. If the element is removed from the document, you must call detachNow(Widget).

Parameters
element the element to be wrapped