All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.bwt.JCTextAreaComponent

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----jclass.bwt.JCComponent
                           |
                           +----jclass.bwt.JCTextComponent
                                   |
                                   +----jclass.bwt.JCTextAreaComponent

public class JCTextAreaComponent
extends JCTextComponent
implements JCScrollableInterface
A private class used by JCTextArea.

See Also:
JCTextArea

Variable Index

 o scrolled_window
Parent window.
 o update_scrollbars
 o visible_rows
The number of visible lines.

Constructor Index

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

Method Index

 o addNotify()
Creates the peer of the canvas.
 o appendRow(String)
Appends a row of text.
 o buildLineTable()
Scans the text and adds it to the line table.
 o checkWidestRow(int)
Checks whether the specified row is the widest.
 o countRows()
 o findWidestRow()
Finds the width of the widest row (pixels).
 o getBounds(int, boolean)
Gets the bounding rectangle of a row, or null if the row is invalid.
 o getCurrentFirstPosition()
 o getCurrentRow()
 o getDoubleBufferGraphics()
Creates a double-buffer image, for subsequent retrieval via getDoubleBufferImage
 o getDoubleBufferImage()
Returns the double-buffer image previously created in a call to getDoubleBufferGraphics.
 o getFirstPosition(int)
Gets the text position of the first char in the row.
 o getHorizOrigin()
Gets the horizontal origin.
 o getLine(int)
Gets the line for the row.
 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 getNumChar(int)
Returns the number of characters in a row.
 o getParameters()
Reads the parameter values from the HTML page using the component's applet.
 o getRowHeight(int)
Gets the height of a row.
 o getRowPosition(int)
Gets the y position of the row, neglecting shadows and scrolling.
 o getRows()
Gets the number of rows.
 o getText(int)
Gets the text for a row, or null if the row is invalid.
 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 getVertOrigin()
Gets the vertical origin.
 o getVisibleRows()
Gets the number of visible rows.
 o getWidestRow()
Gets the width of the widest row (pixels).
 o getWidth(int)
Returns the width of a row (pixels).
 o insertNewLine(Event)
Inserts a newline.
 o invalidate()
Invalidates the component.
 o keyDown(Event, int)
Processes keyDown events.
 o maxLines(int)
 o moveNextLine(Event)
Moves the cursor to the next line.
 o movePreviousLine(Event)
Moves the cursor to the previous line.
 o paintComponent(Graphics)
Draws the text
 o pointToPosition(int, int)
Maps a point to a text position.
 o positionToRow(int)
Gets the row that contains the text position.
 o positionToX(int)
Gets the x co-ordinate for a character position, ignoring scrolling.
 o positionToY(int)
Gets the y co-ordinate for a character position, ignoring scrolling.
 o preferredHeight()
Returns the height of the specified number of rows.
 o readFile(Applet, String)
Reads data from a file and appends it to the field.
 o readFile(InputStream)
Reads data from a file stream and appends it to the textarea.
 o repaintPositions(Point, Point)
Draws the text between 2 points.
 o replaceTextInternal(String, int, int)
Updates the internal text buffer and the line table entry.
 o reshape(int, int, int, int)
Reshapes the Component to the specified bounding box.
 o scrollLineBegin(Event)
Scrolls to the beginning of the current line.
 o scrollLineEnd(Event)
Scrolls to the end of the current line.
 o scrollNextPage(Event)
Scrolls down vertically by a page.
 o scrollPreviousPage(Event)
Scrolls up vertically by a page.
 o setDoubleBuffer(boolean)
Controls whether double-buffering is used when displaying and updating the component.

HTML param name/value: "DoubleBuffer"/boolean

 o setHorizOrigin(int)
Sets the horizontal origin prior to scrolling.
 o setInsets(Insets)
Sets the spacing between the text and the edge of the component.
 o setMultiline(boolean)
If true (default), the user can break text into multiple lines by hitting ENTER.

HTML param name/value: "Multiline"/boolean

 o setRows(int)
Sets the number of rows.

HTML param name/value: "Rows"/int

 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 setVertOrigin(int)
Sets the top row prior to scrolling.
 o showPosition(int)
Scrolls the text if necessary to ensure that the position is visible.
 o updateScrollbars()
 o yToRow(int)
Finds the row specified by the point.

Variables

 o scrolled_window
  protected transient JCScrolledWindow scrolled_window
Parent window.

 o update_scrollbars
  protected boolean update_scrollbars
 o visible_rows
  protected int visible_rows
The number of visible lines.

Constructors

 o JCTextAreaComponent
  public JCTextAreaComponent()
Creates an empty, editable field with 5 rows and 20 columns.

 o JCTextAreaComponent
  public JCTextAreaComponent(String text)
Creates an editable field with the specified text and 5 rows and 20 columns.

 o JCTextAreaComponent
  public JCTextAreaComponent(String text,
                             int rows,
                             int cols)
Creates an editable field with the specified text and number of columns.

 o JCTextAreaComponent
  public JCTextAreaComponent(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 JCTextAreaComponent
  public JCTextAreaComponent(Applet applet,
                             String file,
                             int rows,
                             int cols) throws IOException
Creates an editable 5-row by 20-column 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 getParameters
  protected void getParameters()
Reads the parameter values from the HTML page using the component's applet. The values will override those previously set.

Overrides:
getParameters in class JCTextComponent
 o readFile
  public void readFile(Applet applet,
                       String file) throws IOException
Reads data from a file and appends it to the field.

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 setDoubleBuffer
  public void setDoubleBuffer(boolean v)
Controls whether double-buffering is used when displaying and updating the component.

HTML param name/value: "DoubleBuffer"/boolean

Overrides:
setDoubleBuffer in class JCComponent
 o invalidate
  public void invalidate()
Invalidates the component.

Overrides:
invalidate in class Component
 o getDoubleBufferImage
  public Image getDoubleBufferImage()
Returns the double-buffer image previously created in a call to getDoubleBufferGraphics.

Overrides:
getDoubleBufferImage in class JCComponent
 o getDoubleBufferGraphics
  public synchronized Graphics getDoubleBufferGraphics()
Creates a double-buffer image, for subsequent retrieval via getDoubleBufferImage

Overrides:
getDoubleBufferGraphics in class JCComponent
 o appendRow
  public void appendRow(String text)
Appends a row of text. The cursor is moved to the end of the text.

 o setInsets
  public void setInsets(Insets v)
Sets the spacing between the text and the edge of the component.

Overrides:
setInsets in class JCComponent
 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 setMultiline
  public void setMultiline(boolean v)
If true (default), the user can break text into multiple lines by hitting ENTER.

HTML param name/value: "Multiline"/boolean

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

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

See Also:
setRows
 o setRows
  public void setRows(int r)
Sets the number of rows.

HTML param name/value: "Rows"/int

Throws: IllegalArgumentException
If the value is less than 0.
 o preferredHeight
  protected int preferredHeight()
Returns the height of the specified number of rows.

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

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

 o maxLines
  protected int maxLines(int height)
 o reshape
  public synchronized void reshape(int x,
                                   int y,
                                   int width,
                                   int height)
Reshapes the Component to the specified bounding box.

Overrides:
reshape in class JCTextComponent
 o addNotify
  public void addNotify()
Creates the peer of the canvas.

Overrides:
addNotify in class JCTextComponent
 o updateScrollbars
  protected void updateScrollbars()
Overrides:
updateScrollbars in class JCTextComponent
 o buildLineTable
  protected void buildLineTable()
Scans the text and adds it to the line table.

 o replaceTextInternal
  protected synchronized void replaceTextInternal(String str,
                                                  int start,
                                                  int end)
Updates the internal text buffer and the line table entry.

Overrides:
replaceTextInternal in class JCTextComponent
 o positionToX
  public int positionToX(int pos)
Gets the x co-ordinate for a character position, ignoring scrolling.

Overrides:
positionToX in class JCTextComponent
 o positionToY
  public int positionToY(int pos)
Gets the y co-ordinate for a character position, ignoring scrolling.

Overrides:
positionToY in class JCTextComponent
 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.
Overrides:
showPosition in class JCTextComponent
 o getRowHeight
  protected int getRowHeight(int row)
Gets the height of a row.

 o getRowPosition
  protected int getRowPosition(int row)
Gets the y position of the row, neglecting shadows and scrolling.

 o yToRow
  public int yToRow(int y)
Finds the row specified by the point.

Returns:
BWTEnum.NOTFOUND if the text area has not been added to a container
 o paintComponent
  protected synchronized void paintComponent(Graphics gc)
Draws the text

Overrides:
paintComponent in class JCComponent
 o getBounds
  public Rectangle getBounds(int row,
                             boolean adjust)
Gets the bounding rectangle of a row, or null if the row is invalid.

Parameters:
adjust - if true, the co-ordinates are adjusted by the amount that the field has been scrolled.
 o repaintPositions
  protected synchronized void repaintPositions(Point p1,
                                               Point p2)
Draws the text between 2 points.

Overrides:
repaintPositions in class JCTextComponent
 o getNumChar
  protected int getNumChar(int row)
Returns the number of characters in a row.

 o getWidth
  protected int getWidth(int row)
Returns the width of a row (pixels).

 o getVisibleRows
  public int getVisibleRows()
Gets the number of visible rows.

 o getText
  public String getText(int row)
Gets the text for a row, or null if the row is invalid.

 o getLine
  protected TextLine getLine(int row)
Gets the line for the row.

 o getFirstPosition
  protected int getFirstPosition(int row)
Gets the text position of the first char in the row.

 o positionToRow
  protected int positionToRow(int pos)
Gets the row that contains the text position.

 o getWidestRow
  protected int getWidestRow()
Gets the width of the widest row (pixels).

 o checkWidestRow
  protected void checkWidestRow(int row)
Checks whether the specified row is the widest.

 o findWidestRow
  protected void findWidestRow()
Finds the width of the widest row (pixels).

 o countRows
  protected int countRows()
 o getCurrentRow
  protected int getCurrentRow()
 o getCurrentFirstPosition
  protected int getCurrentFirstPosition()
 o pointToPosition
  public int pointToPosition(int x,
                             int y)
Maps a point to a text position.

Overrides:
pointToPosition in class JCTextComponent
 o scrollLineEnd
  protected void scrollLineEnd(Event ev)
Scrolls to the end of the current line.

Overrides:
scrollLineEnd in class JCTextComponent
 o scrollLineBegin
  protected void scrollLineBegin(Event ev)
Scrolls to the beginning of the current line.

Overrides:
scrollLineBegin in class JCTextComponent
 o moveNextLine
  protected void moveNextLine(Event ev)
Moves the cursor to the next line. If the Shift key is pressed, the selection is extended.

 o movePreviousLine
  protected void movePreviousLine(Event ev)
Moves the cursor to the previous line. If the Shift key is pressed, the selection is extended.

 o scrollNextPage
  protected void scrollNextPage(Event ev)
Scrolls down vertically by a page.

 o scrollPreviousPage
  protected void scrollPreviousPage(Event ev)
Scrolls up vertically by a page.

 o insertNewLine
  protected boolean insertNewLine(Event ev)
Inserts a newline.

Returns:
false if the insertion was disallowed
 o keyDown
  public boolean keyDown(Event ev,
                         int key)
Processes keyDown events.
CTRL/A      scrollHome
CTRL/D      deleteCurrentChar
CTRL/E      scrollEnd
CTRL/O      toggleOverstrike
CTRL/C      copyToClipboard
CTRL/X      cutToClipboard
CTRL/V      pasteFromClipboard
HOME        scrollHome
END         scrollEnd
PAGE-UP     scrollPreviousPage
PAGE-DOWN   scrollNextPage
UP          movePreviousLine
DOWN        moveNextLine
RIGHT       moveForwardChar
LEFT        moveBackwardChar
BS          deletePreviousChar
DELETE      deleteCurrentChar
ENTER       insertNewLine
any other   insertChar

Overrides:
keyDown in class JCTextComponent
 o getHorizOrigin
  public int getHorizOrigin()
Gets the horizontal origin.

 o setHorizOrigin
  public void setHorizOrigin(int v)
Sets the horizontal origin prior to scrolling.

 o getVertOrigin
  public int getVertOrigin()
Gets the vertical origin.

 o setVertOrigin
  public void setVertOrigin(int value)
Sets the top row prior to scrolling.


All Packages  Class Hierarchy  This Package  Previous  Next  Index