    All Packages    This Package    Previous    Next

# Class awt.TextArea

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

public class TextArea
extends Component

A TextArea object is a multi-line area that displays text. It can be made editable or read-only.

Version:
  1.10 03 Feb 1995
Author:
  Sami Shaio

##

TextArea(Container, String, Font, int, int)
  Constructs a TextArea.

##

cursorPos()
  Return the cursor position.
dispose()
  Disposes of this TextArea.
endPos()
  Return the last position in the TextArea.
getPreferredSize()
  Returns the natural size of the object.
getText()
  Return the contents of this TextArea.
insertText(String, int)
  Inserts text at the given position.
isEditable()
map()
  Makes this TextArea visible.
move(int, int)
  Moves this TextArea to the given position.
replaceText(String, int, int)
  Replaces the text from start to end.
reshape(int, int, int, int)
  Reshapes this TextArea.
setCursorPos(int)
  Sets the cursor position and makes that position visible.
setEditable(boolean)
  Sets whether this TextArea is editable or not.
setHFill(boolean)
  Sets whether or not this List stretches horizontally.
setText(String)
  Sets the text of this TextArea to the specified value.
setVFill(boolean)
  Sets whether or not this List stretches vertically.
unMap()
  Hides this TextArea.

##

TextArea

      public TextArea(Container p,
                      String pName,
                      Font f,
                      int columns,
                      int rows)

  Constructs a TextArea.
  Parameters:
    p - is the parent Window
    pName - is the name of the TextArea. Some layouts such as BorderLayout, use the name for layout.
    f - is the font to use. It can be null.
    columns - is the number of columns in terms of the current font.
    rows - is the number of rows in terms of the current font.

##

setEditable

      public void setEditable(boolean t)

  Sets whether this TextArea is editable or not.

cursorPos

      public int cursorPos()

  Return the cursor position.
  Returns:
    the cursor position.

setCursorPos

      public void setCursorPos(int pos)

  Sets the cursor position and makes that position visible.
  Parameters:
    pos - is the position to set the cursor to.

endPos

      public int endPos()

  Return the last position in the TextArea.
  Returns:
    the last position in the TextArea.

isEditable

      public boolean isEditable()

  Returns:
    whether this TextArea is editable or not.

setText

      public void setText(String text)

  Sets the text of this TextArea to the specified value.
  Parameters:
    text - the text to set as the contents.

getText

      public String getText()

  Return the contents of this TextArea.
  Returns:
    contents of the TextArea.

insertText

      public void insertText(String text,
                             int pos)

  Inserts text at the given position.
  Parameters:
    text - the text to insert.
    pos - the position to insert at.

replaceText

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

  Replaces the text from start to end.
  Parameters:
    text - the text to use as the replacement.
    start - the start position.
    end - the end position.

setHFill

      public void setHFill(boolean t)

  Sets whether or not this List stretches horizontally.

setVFill

      public void setVFill(boolean t)

  Sets whether or not this List stretches vertically.

dispose

      public void dispose()

  Disposes of this TextArea. It cannot be used after being disposed.
  Overrides:
    dispose in class Component

getPreferredSize

      public Dimension getPreferredSize()

  Returns the natural size of the object.
  Overrides:
    getPreferredSize in class Component

move

      public void move(int X,
                       int Y)

  Moves this TextArea to the given position.
  Parameters:
    X - the x position to move to.
    Y - the y position to move to.
  Overrides:
    move in class Component

reshape

      public void reshape(int x,
                          int y,
                          int w,
                          int h)

  Reshapes this TextArea.
  Parameters:
    x - the x position.
    y - the y position.
    w - the width in pixels.
    h - the height in pixels.
  Overrides:
    reshape in class Component

map

      public void map()

  Makes this TextArea visible.
  Overrides:
    map in class Component

unMap

      public void unMap()

  Hides this TextArea.
  Overrides:
    unMap in class Component

    All Packages    This Package    Previous    Next