All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.bwt.JCTextArea

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----jclass.bwt.JCContainer
                                   |
                                   +----jclass.bwt.JCScrolledWindow
                                           |
                                           +----jclass.bwt.JCTextArea

public class JCTextArea
extends JCScrolledWindow
implements JCTextAreaInterface
A JCTextArea component is a multi-line area that displays text.

Properties

Name Method
Alignment setAlignment
Background setBackground
CaretPosition setCaretPosition
Columns setColumns
CursorPosition setCursorPosition
Editable setEditable
Font setFont
Foreground setForeground
Insets setInsets
MaximumLength setMaximumLength
Multiline setMultiline
Overstrike setOverstrike
PreferredSize setPreferredSize
Rows setRows
ScrollbarDisplay setScrollbarDisplay
ScrollbarOffset setScrollbarOffset
SelectedBackground setSelectedBackground
SelectedForeground setSelectedForeground
SelectionEnd setSelectionEnd
SelectionList setSelectionList
SelectionStart setSelectionStart
ShadowThickness setShadowThickness
ShowCursorPosition setShowCursorPosition
StringCase setStringCase
Text setText
TopCharacter setTopCharacter
TopRow setTopRow
Traversable setTraversable
UserData setUserData

Events

JCTextCursorEvent
Class Listener Description
JCTextEvent addTextListener Posted when the value changes
addTextCursorListener Posted when the cursor is moved


Variable Index

 o CASE_AS_IS
 o CASE_LOWER
 o CASE_UPPER
 o CENTER
 o LEFT
 o RIGHT

Constructor Index

 o JCTextArea()
Creates an empty JCTextArea with 5 rows and 20 columns.
 o JCTextArea(Applet, String, int, int)
Creates an editable field with the text from the specified file.
 o JCTextArea(String)
Creates a new JCTextArea with the specified text and 5 rows by 20 columns.
 o JCTextArea(String, Applet, String)
Creates a TextArea which reads parameters from the applet's HTML file.
 o JCTextArea(String, int, int)
Creates a new JCTextArea with the specified text and number of rows and columns.
 o JCTextArea(String, int, int, int)
Constructs a new TextArea with the specified text and number of rows, columns, and scrollbar visibility.

Method Index

 o addTextCursorListener(JCTextCursorListener)
Adds the specified JCTextCursorEvent listener to receive cursor movement events.
 o addTextListener(JCTextListener)
Adds the specified listener to receive text events.
 o append(String)
Appends text to the end.
 o appendRow(String)
Appends a row of text.
 o beep()
Emits a beep.
 o getAlignment()
Gets the field's alignment.
 o getCaretPosition()
Gets the position of the cursor (provided for JDK 1.1 compatibility).
 o getChanged()
Returns true if the user has changed the value since the last programmatic setting.
 o getColumns()
Returns the number of columns.
 o getCursorPosition()
Gets the position of the cursor.
 o getEditable()
Returns the boolean indicating whether this component is editable or not.
 o getLastPosition()
Gets the position of the last character in the text.
 o getMaximumLength()
Gets the MaximumLength value.
 o getMinimumSize(int)
Returns the minimum size needed for the specified number of columns.
 o getMinimumSize(int, int)
Returns the minimum size needed for the specified number of rows and columns.
 o getMultiline()
Gets the Multiline value.
 o getOverstrike()
Gets the Overstrike value.
 o getRows()
Returns the number of rows.
 o getSelectedBackground()
Gets the SelectedBackground value.
 o getSelectedForeground()
Gets the SelectedForeground value.
 o getSelectedText()
Returns the selected text contained in this component.
 o getSelectionEnd()
Returns the selected text's end position.
 o getSelectionList()
Gets the current SelectionList.
 o getSelectionStart()
Returns the selected text's start position.
 o getShadowThickness()
Gets the shadow's thickness.

HTML param name/value: "ShadowThickness"/int

 o getShowCursorPosition()
Gets the ShowCursorPosition value.
 o getStringCase()
Gets the StringCase value.
 o getText()
Returns the text contained in this component.
 o getTextComponent()
Gets the internal text area.
 o getTopCharacter()
Gets the position of the leftmost character on the first line currently displayed, or 0 if the component is empty.
 o getTopRow()
Gets the current top-most visible row.
 o getViewportHeight()
Sets the work area height to be the text area's virtual height.
 o getViewportWidth()
Sets the work area width to be the text's virtual width.
 o gotFocus(Event, Object)
 o insert(String, int)
Inserts text at the specified position.
 o isEditable()
Returns the boolean indicating whether this component is editable or not.
 o isFocusTraversable()
Returns whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal.
 o isTraversable()
Returns true if the component can accept focus - it must be traversable, showing, and enabled.
 o pointToPosition(int, int)
Maps a physical position to the corresponding character position.
 o readFile(Applet, String)
Reads data from a file and appends it to the textarea.
 o readFile(InputStream)
Reads data from a file stream and appends it to the textarea.
 o removeTextCursorListener(JCTextCursorListener)
Removes the specified listener so it no longer receives JCTextCursorEvents.
 o removeTextListener(JCTextListener)
Removes the specified text listener so it no longer receives text events.
 o replaceRange(String, int, int)
Replaces the existing text between two positions with the specified text.
 o scrollVertical(int)
Scrolls the window vertically to the specified row.
 o scrollVertical(JCScrollableInterface, JCAdjustmentEvent, int)
Scrolls a scrollableInterface component vertically.
 o select(int, int)
Selects the text found between the specified start and end locations.
 o selectAll()
Selects all the text in the component.
 o setAlignment(int)
Sets the position of the text:
LEFT (default), CENTER, or RIGHT.
 o setCaretPosition(int)
Sets the position of the cursor (provided for JDK 1.1 compatibility).
 o setColumns(int)
Sets the number of columns.
 o setCursorPosition(int)
Sets the position of the cursor.
 o setEditable(boolean)
Determines whether this component is editable.
 o setHorizScrollbarValues(int, int, int, int)
This method may be overriden by a subclass to set the horizontal scrollbar's values.
 o setMaximumLength(int)
Sets the maximum number of characters which may be entered by the user (default: BWTEnum.MAXINT).
 o setMultiline(boolean)
If true (default), the user can break text into multiple lines by hitting Enter.
 o setOverstrike(boolean)
If false (default), characters typed by the user are inserted into the current text.
 o setRows(int)
Sets the number of rows.
 o setSelectedBackground(Color)
Sets the background color of selected text (default: blue).

HTML param name/value: "SelectedBackground"/color

 o setSelectedForeground(Color)
Sets the foreground color of selected text (default: background color).

HTML param name/value: "SelectedForeground"/color

 o setSelectionEnd(int)
Gets the selected text's end position.
 o setSelectionList(int[])
Sets a list of values used for multi-click.
 o setSelectionStart(int)
Gets the selected text's start position.
 o setShadowThickness(int)
Sets the shadow's thickness (default: 2)
 o setShowCursorPosition(boolean)
If set to true (default), the cursor position will be indicated with a vertical I-beam.
 o setStringCase(int)
Sets the case of text entered by the user or set programmatically:
CASE_AS_IS       No conversion (default)
CASE_LOWER       Convert to lower case
CASE_UPPER       Convert to upper case

HTML param name/value: "StringCase"/enum

 o setText(String)
Sets the text of this component to the specified text.
 o setTextComponent(JCTextAreaComponent)
Replaces the current internal text component.
 o setTopCharacter(int)
Sets the position of the leftmost character on the first line currently displayed.
 o setTopRow(int)
Sets the top-most visible row.
 o setTraversable(boolean)
Sets whether the component can accept focus (default: true).

HTML param name/value: "Traversable"/boolean

 o setVertScrollbarValues(int, int, int, int)
This method may be overriden by a subclass to set the vertical scrollbar's values.
 o showPosition(int)
Scrolls the text if necessary to ensure that the position is visible.

Variables

 o LEFT
  public final static int LEFT
 o CENTER
  public final static int CENTER
 o RIGHT
  public final static int RIGHT
 o CASE_AS_IS
  public final static int CASE_AS_IS
 o CASE_LOWER
  public final static int CASE_LOWER
 o CASE_UPPER
  public final static int CASE_UPPER

Constructors

 o JCTextArea
  public JCTextArea()
Creates an empty JCTextArea with 5 rows and 20 columns. No parameters are read from an HTML file.

 o JCTextArea
  public JCTextArea(String text)
Creates a new JCTextArea with the specified text and 5 rows by 20 columns. No parameters are read from an HTML file.

 o JCTextArea
  public JCTextArea(String text,
                    int rows,
                    int cols)
Creates a new JCTextArea with the specified text and number of rows and columns. No parameters are read from an HTML file.

 o JCTextArea
  public JCTextArea(String text,
                    int rows,
                    int columns,
                    int sb_display)
Constructs a new TextArea with the specified text and number of rows, columns, and scrollbar visibility.

Parameters:
sb_display - the visibility of scrollbars
See Also:
setScrollbarDisplay
 o JCTextArea
  public JCTextArea(String text,
                    Applet applet,
                    String name)
Creates a TextArea which reads parameters from the applet's HTML file.

Parameters:
applet - the applet whose PARAM tags are to be read
name - if this is not null, only parameters preceded by this name are read
See Also:
getParameter, JCString
 o JCTextArea
  public JCTextArea(Applet applet,
                    String file,
                    int rows,
                    int cols) throws IOException
Creates an editable field with the text from the specified file.

Parameters:
applet - if not null, its documentBase() is used to construct a complete filename if necessary.
file - the file to be read. If an http protocol is not specified (a ":" is not present), the current working directory is prepended to the file name
rows,cols - the number of rows and columns to display
Throws: IOException
If an I/O error has occurred.
See Also:
readFile

Methods

 o getTextComponent
  public JCTextAreaComponent getTextComponent()
Gets the internal text area.

 o setTextComponent
  public void setTextComponent(JCTextAreaComponent text)
Replaces the current internal text component.

 o getViewportWidth
  protected int getViewportWidth()
Sets the work area width to be the text's virtual width.

Overrides:
getViewportWidth in class JCScrolledWindow
 o getViewportHeight
  protected int getViewportHeight()
Sets the work area height to be the text area's virtual height.

Overrides:
getViewportHeight in class JCScrolledWindow
 o setHorizScrollbarValues
  protected void setHorizScrollbarValues(int value,
                                         int visible,
                                         int min,
                                         int max)
This method may be overriden by a subclass to set the horizontal scrollbar's values.

Overrides:
setHorizScrollbarValues in class JCScrolledWindow
 o setVertScrollbarValues
  protected void setVertScrollbarValues(int value,
                                        int visible,
                                        int min,
                                        int max)
This method may be overriden by a subclass to set the vertical scrollbar's values.

Overrides:
setVertScrollbarValues in class JCScrolledWindow
 o scrollVertical
  protected void scrollVertical(JCScrollableInterface scrollable,
                                JCAdjustmentEvent ev,
                                int value)
Scrolls a scrollableInterface component vertically.

Overrides:
scrollVertical in class JCScrolledWindow
 o scrollVertical
  public void scrollVertical(int row)
Scrolls the window vertically to the specified row.

Overrides:
scrollVertical in class JCScrolledWindow
 o getMinimumSize
  public Dimension getMinimumSize(int columns)
Returns the minimum size needed for the specified number of columns.

 o getMinimumSize
  public Dimension getMinimumSize(int rows,
                                  int columns)
Returns the minimum size needed for the specified number of rows and columns.

 o getChanged
  public boolean getChanged()
Returns true if the user has changed the value since the last programmatic setting.

 o beep
  public void beep()
Emits a beep.

 o addTextListener
  public void addTextListener(JCTextListener l)
Adds the specified listener to receive text events.

See Also:
JCTextEvent, JCTextListener
 o removeTextListener
  public void removeTextListener(JCTextListener l)
Removes the specified text listener so it no longer receives text events.

 o addTextCursorListener
  public void addTextCursorListener(JCTextCursorListener l)
Adds the specified JCTextCursorEvent listener to receive cursor movement events.

See Also:
JCTextCursorEvent
 o removeTextCursorListener
  public void removeTextCursorListener(JCTextCursorListener l)
Removes the specified listener so it no longer receives JCTextCursorEvents.

See Also:
addTextCursorListener
 o readFile
  public void readFile(Applet applet,
                       String file) throws IOException
Reads data from a file and appends it to the textarea.

Parameters:
applet - if not null, its documentBase() is used to construct a complete filename if necessary.
file - the file to be read. If an http protocol is not specified (a ":" is not present), the current working directory is prepended to the file name
Throws: IOException
If an I/O error has occurred.
 o readFile
  public void readFile(InputStream stream) throws IOException
Reads data from a file stream and appends it to the textarea.

Throws: IOException
If an I/O error has occurred.
 o setText
  public void setText(String t)
Sets the text of this component to the specified text.

See Also:
getText
 o getText
  public String getText()
Returns the text contained in this component.

See Also:
setText
 o getSelectedText
  public String getSelectedText()
Returns the selected text contained in this component.

See Also:
setText
 o getMaximumLength
  public int getMaximumLength()
Gets the MaximumLength value.

See Also:
setMaximumLength
 o setMaximumLength
  public void setMaximumLength(int v)
Sets the maximum number of characters which may be entered by the user (default: BWTEnum.MAXINT). If the user attempts to enter more characters, the values will be ignored and the bell will be sounded. This value is ignored for values set programmatically.

HTML param name/value: "MaximumLength"/int

See Also:
setText
 o getStringCase
  public int getStringCase()
Gets the StringCase value.

See Also:
setStringCase
 o setStringCase
  public void setStringCase(int v)
Sets the case of text entered by the user or set programmatically:
CASE_AS_IS       No conversion (default)
CASE_LOWER       Convert to lower case
CASE_UPPER       Convert to upper case

HTML param name/value: "StringCase"/enum

Throws: IllegalArgumentException
If an invalid value is set
 o isEditable
  public boolean isEditable()
Returns the boolean indicating whether this component is editable or not.

See Also:
setEditable
 o getEditable
  public boolean getEditable()
Returns the boolean indicating whether this component is editable or not.

See Also:
setEditable
 o setEditable
  public void setEditable(boolean t)
Determines whether this component is editable.

See Also:
isEditable
 o getSelectionStart
  public int getSelectionStart()
Returns the selected text's start position.

 o getSelectionEnd
  public int getSelectionEnd()
Returns the selected text's end position.

 o setSelectionStart
  public void setSelectionStart(int pos)
Gets the selected text's start position.

 o setSelectionEnd
  public void setSelectionEnd(int pos)
Gets the selected text's end position.

 o select
  public void select(int start,
                     int end)
Selects the text found between the specified start and end locations.

 o selectAll
  public void selectAll()
Selects all the text in the component.

 o insert
  public void insert(String str,
                     int pos)
Inserts text at the specified position.

See Also:
setText, replaceRange
 o append
  public void append(String str)
Appends text to the end. The cursor is moved to the end of the text.

See Also:
insert
 o appendRow
  public void appendRow(String str)
Appends a row of text. The cursor is moved to the end of the text.

 o replaceRange
  public void replaceRange(String str,
                           int start,
                           int end)
Replaces the existing text between two positions with the specified text.

See Also:
insert
 o getSelectionList
  public int[] getSelectionList()
Gets the current SelectionList.

See Also:
setSelectionList
 o setSelectionList
  public void setSelectionList(int list[])
Sets a list of values used for multi-click. As the mouse is clicked in rapid succession, each click selects the next type in the list. Valid values (in order of the default list):
 SELECT_POSITION     Selects the current pointer position
 SELECT_WORD         Selects the current word
 SELECT_LINE         Selects the current line
 SELECT_ALL          Selects all the text
 
Default list: { SELECT_POSITION, SELECT_WORD, SELECT_LINE, SELECT_ALL }

 o setMultiline
  public void setMultiline(boolean v)
If true (default), the user can break text into multiple lines by hitting Enter.

 o getMultiline
  public boolean getMultiline()
Gets the Multiline value.

See Also:
setMultiline
 o getRows
  public int getRows()
Returns the number of rows.

See Also:
setRows
 o getColumns
  public int getColumns()
Returns the number of columns.

See Also:
setColumns
 o setRows
  public void setRows(int v)
Sets the number of rows. The component will attempt to resize itself to display this number of lines in the current font.

Throws: IllegalArgumentException
If the value is less than 0.
 o setColumns
  public void setColumns(int v)
Sets the number of columns. The component will attempt to resize itself to display this number of N's in the current font.

Throws: IllegalArgumentException
If the value is less than 0.
 o getSelectedBackground
  public Color getSelectedBackground()
Gets the SelectedBackground value.

See Also:
setSelectedBackground
 o setSelectedBackground
  public void setSelectedBackground(Color v)
Sets the background color of selected text (default: blue).

HTML param name/value: "SelectedBackground"/color

See Also:
toColor
 o getSelectedForeground
  public Color getSelectedForeground()
Gets the SelectedForeground value.

See Also:
setSelectedForeground
 o setSelectedForeground
  public void setSelectedForeground(Color v)
Sets the foreground color of selected text (default: background color).

HTML param name/value: "SelectedForeground"/color

See Also:
toColor
 o pointToPosition
  public int pointToPosition(int x,
                             int y)
Maps a physical position to the corresponding character position.

 o showPosition
  public void showPosition(int pos)
Scrolls the text if necessary to ensure that the position is visible.

Parameters:
pos - the number of characters from the beginning of the text buffer.
 o getTopRow
  public int getTopRow()
Gets the current top-most visible row.

See Also:
setTopRow
 o setTopRow
  public void setTopRow(int row)
Sets the top-most visible row.

 o getTopCharacter
  public int getTopCharacter()
Gets the position of the leftmost character on the first line currently displayed, or 0 if the component is empty.

See Also:
setTopCharacter
 o setTopCharacter
  public void setTopCharacter(int pos)
Sets the position of the leftmost character on the first line currently displayed. This is the number of characters from the beginning of the text buffer. The first character position is 0.

See Also:
setTopRow
 o getCursorPosition
  public int getCursorPosition()
Gets the position of the cursor.

See Also:
setCursorPosition
 o setCursorPosition
  public void setCursorPosition(int pos)
Sets the position of the cursor.

 o setOverstrike
  public void setOverstrike(boolean v)
If false (default), characters typed by the user are inserted into the current text.

 o getOverstrike
  public boolean getOverstrike()
Gets the Overstrike value.

See Also:
setOverstrike
 o getLastPosition
  public int getLastPosition()
Gets the position of the last character in the text. This represents the position that text appended to the component would be placed after.

 o getShowCursorPosition
  public boolean getShowCursorPosition()
Gets the ShowCursorPosition value.

See Also:
setShowCursorPosition
 o setShowCursorPosition
  public void setShowCursorPosition(boolean v)
If set to true (default), the cursor position will be indicated with a vertical I-beam.

 o getAlignment
  public int getAlignment()
Gets the field's alignment.

See Also:
setAlignment
 o setAlignment
  public void setAlignment(int v)
Sets the position of the text:
LEFT (default), CENTER, or RIGHT. HTML param name/value: "Alignment"/enum

Throws: IllegalArgumentException
If an invalid value is set
 o getCaretPosition
  public int getCaretPosition()
Gets the position of the cursor (provided for JDK 1.1 compatibility).

See Also:
getCursorPosition
 o setCaretPosition
  public void setCaretPosition(int pos)
Sets the position of the cursor (provided for JDK 1.1 compatibility).

See Also:
setCursorPosition
 o gotFocus
  public boolean gotFocus(Event ev,
                          Object what)
Overrides:
gotFocus in class Component
 o getShadowThickness
  public int getShadowThickness()
Gets the shadow's thickness.

HTML param name/value: "ShadowThickness"/int

See Also:
setShadowThickness
 o setShadowThickness
  public void setShadowThickness(int v)
Sets the shadow's thickness (default: 2)

 o isTraversable
  public boolean isTraversable()
Returns true if the component can accept focus - it must be traversable, showing, and enabled.

See Also:
setTraversable, isEnabled, isShowing
 o isFocusTraversable
  public boolean isFocusTraversable()
Returns whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal.

Overrides:
isFocusTraversable in class Component
See Also:
setTraversable
 o setTraversable
  public void setTraversable(boolean v)
Sets whether the component can accept focus (default: true).

HTML param name/value: "Traversable"/boolean

See Also:
toBoolean

All Packages  Class Hierarchy  This Package  Previous  Next  Index