    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class java.awt.TextArea

    java.lang.Object
       |
       +----java.awt.Component
               |
               +----java.awt.TextComponent
                       |
                       +----java.awt.TextArea

public class TextArea
extends TextComponent

A TextArea object is a multi-line area that displays text. It can be set to allow editing or read-only modes.

##

SCROLLBARS_BOTH
  Create and display both vertical and horizontal scrollbars.
SCROLLBARS_HORIZONTAL_ONLY
  Create and display horizontal scrollbar only.
SCROLLBARS_NONE
  Do not create or display any scrollbars for the text area.
SCROLLBARS_VERTICAL_ONLY
  Create and display vertical scrollbar only.

##

TextArea()
  Constructs a new TextArea.
TextArea(int, int)
  Constructs a new empty TextArea with the specified number of rows and columns.
TextArea(String)
  Constructs a new TextArea with the specified text displayed.
TextArea(String, int, int)
  Constructs a new TextArea with the specified text and number of rows and columns.
TextArea(String, int, int, int)
  Constructs a new TextArea with the specified text and number of rows, columns, and scrollbar visibility.

##

addNotify()
  Creates the TextArea's peer.
append(String)
  Appends the given text to the end.
appendText(String)
  Deprecated.
getColumns()
  Returns the number of columns in the TextArea.
getMinimumSize()
  Returns the minimum size Dimensions of the TextArea.
getMinimumSize(int, int)
  Returns the specified minimum size Dimensions of the TextArea.
getPreferredSize()
  Returns the preferred size Dimensions of the TextArea.
getPreferredSize(int, int)
  Returns the specified row and column Dimensions of the TextArea.
getRows()
  Returns the number of rows in the TextArea.
getScrollbarVisibility()
  Returns the enumerated value describing which scrollbars the text area has.
insert(String, int)
  Inserts the specified text at the specified position.
insertText(String, int)
  Deprecated.
minimumSize()
  Deprecated.
minimumSize(int, int)
  Deprecated.
paramString()
  Returns the String of parameters for this TextArea.
preferredSize()
  Deprecated.
preferredSize(int, int)
  Deprecated.
replaceRange(String, int, int)
  Replaces text from the indicated start to end position with the new text specified.
replaceText(String, int, int)
  Deprecated.
setColumns(int)
  Sets the number of columns for this TextArea.
setRows(int)
  Sets the number of rows for this TextArea.

##

SCROLLBARS_BOTH

      public final static int SCROLLBARS_BOTH

  Create and display both vertical and horizontal scrollbars.

SCROLLBARS_VERTICAL_ONLY

      public final static int SCROLLBARS_VERTICAL_ONLY

  Create and display vertical scrollbar only.

SCROLLBARS_HORIZONTAL_ONLY

      public final static int SCROLLBARS_HORIZONTAL_ONLY

  Create and display horizontal scrollbar only.

SCROLLBARS_NONE

      public final static int SCROLLBARS_NONE

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

##

TextArea

      public TextArea()

  Constructs a new TextArea.

TextArea

      public TextArea(String text)

  Constructs a new TextArea with the specified text displayed.

  Parameters:
    text - the text to be displayed

TextArea

      public TextArea(int rows,
                      int columns)

  Constructs a new empty TextArea with the specified number of rows and columns.

  Parameters:
    rows - the number of rows
    columns - the number of columns

TextArea

      public TextArea(String text,
                      int rows,
                      int columns)

  Constructs a new TextArea with the specified text and number of rows and columns.

  Parameters:
    text - the text to be displayed
    rows - the number of rows
    columns - the number of columns

TextArea

      public TextArea(String text,
                      int rows,
                      int columns,
                      int scrollbars)

  Constructs a new TextArea with the specified text and number of rows, columns, and scrollbar visibility.

  Parameters:
    text - the text to be displayed
    rows - the number of rows
    columns - the number of columns
    scrollbars - the visibility of scrollbars

##

addNotify

      public void addNotify()

  Creates the TextArea's peer. The peer allows us to modify the appearance of the TextArea without changing any of its functionality.

  Overrides:
    addNotify in class Component

insert

      public synchronized void insert(String str,
                                      int pos)

  Inserts the specified text at the specified position.

  Parameters:
    str - the text to insert.
    pos - the position at which to insert.
  See Also:
    setText, replaceRange

insertText

      public void insertText(String str,
                             int pos)

  Note: insertText() is deprecated. As of JDK version 1.1, replaced by insert(String, int).

append

      public synchronized void append(String str)

  Appends the given text to the end.

  Parameters:
    str - the text to insert
  See Also:
    insert

appendText

      public void appendText(String str)

  Note: appendText() is deprecated. As of JDK version 1.1, replaced by append(String).

replaceRange

      public synchronized void replaceRange(String str,
                                            int start,
                                            int end)

  Replaces text from the indicated start to end position with the new text specified.

  Parameters:
    str - the text to use as the replacement.
    start - the start position.
    end - the end position.
  See Also:
    insert, replaceRange

replaceText

      public void replaceText(String str,
                              int start,
                              int end)

  Note: replaceText() is deprecated. As of JDK version 1.1, replaced by replaceRange(String, int, int).

getRows

      public int getRows()

  Returns the number of rows in the TextArea.

setRows

      public void setRows(int rows)

  Sets the number of rows for this TextArea.

  Parameters:
    rows - the number of rows
  Throws: IllegalArgumentException
    If rows is less than 0.

getColumns

      public int getColumns()

  Returns the number of columns in the TextArea.

setColumns

      public void setColumns(int columns)

  Sets the number of columns for this TextArea.

  Parameters:
    columns - the number of columns
  Throws: IllegalArgumentException
    If columns is less than 0.

getScrollbarVisibility

      public int getScrollbarVisibility()

  Returns the enumerated value describing which scrollbars the text area has.

  Returns:
    the display policy for the scrollbars

getPreferredSize

      public Dimension getPreferredSize(int rows,
                                        int columns)

  Returns the specified row and column Dimensions of the TextArea.

  Parameters:
    rows - the preferred rows amount
    columns - the preferred columns amount

preferredSize

      public Dimension preferredSize(int rows,
                                     int columns)

  Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize(int, int).

getPreferredSize

      public Dimension getPreferredSize()

  Returns the preferred size Dimensions of the TextArea.

  Overrides:
    getPreferredSize in class Component

preferredSize

      public Dimension preferredSize()

  Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize().

  Overrides:
    preferredSize in class Component

getMinimumSize

      public Dimension getMinimumSize(int rows,
                                      int columns)

  Returns the specified minimum size Dimensions of the TextArea.

  Parameters:
    rows - the minimum row size
    columns - the minimum column size

minimumSize

      public Dimension minimumSize(int rows,
                                   int columns)

  Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize(int, int).

getMinimumSize

      public Dimension getMinimumSize()

  Returns the minimum size Dimensions of the TextArea.

  Overrides:
    getMinimumSize in class Component

minimumSize

      public Dimension minimumSize()

  Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize().

  Overrides:
    minimumSize in class Component

paramString

      protected String paramString()

  Returns the String of parameters for this TextArea.

  Overrides:
    paramString in class TextComponent

    All Packages  Class Hierarchy  This Package  Previous  Next  Index