Class powersoft.jcm.ui.TextBox
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class powersoft.jcm.ui.TextBox

java.lang.Object
   |
   +----powersoft.jcm.ui.Component
           |
           +----powersoft.jcm.ui.TextBox

public class TextBox
extends Component
A control in which the user can enter or edit text. Text boxes support basic editing functions such as character insertion and deletion, text wrapping, and horizontal and vertical scrolling.

On the Component palette, text boxes are represented by the following:

Text boxes can be defined to support a single line or multiple lines of text and a single font setting.

A text box can be bound to a data source so that it can display the contents of a column of a database. See the DataSource and DataColumns properties.

If you need to display static text, such as a label, use the Label component.

See Also:
DataSource, DataColumns, Label, ListBox

Variable Index

 o _changeVector

Constructor Index

 o TextBox()

Method Index

 o addChangeListener(ChangeListener)
 o appendText(String)
Appends text to the text in a text box.
 o clear()
Clears text from a text box.
 o createAWTComponent(Component)
 o getCaretPosition()
Gets the position of the insertion caret in the text box.
 o getChangeListeners()
 o getEditSelection()
Determines the selected text in a text box.
 o getLineCount()
Determines the number of lines of text in a text box.
 o getModified()
Determines whether the text box has been modified.
 o getMultiLine()
Determines whether the text box can contain a single line or multiple lines of text.
 o getPasswordCharacter()
Retrieves the password character.
 o getReadOnly()
Determines whether the text box is read only.
 o getSelectedText()
Returns the selected portion of text in a text box.
 o getText()
Returns the text in a text box.
 o getText(int)
Returns the text for a specified line in a multiline text box.
 o getTextLength(int)
Returns the length of the text for a specified line in a multiline text box.
 o getTokenizedText()
 o handleChange(ChangeEvent)
 o insertText(String)
Inserts text at the current position.
 o lineIndex(int)
Returns the zero-based line index of the line in a multiline text box containing the n'th token.
 o processAWTEvent(Event)
 o recreate()
 o removeChangeListener(ChangeListener)
 o setCaretPosition(int)
Sets the position of the insertion caret in the text box.
 o setEditSelection(Range)
Sets the selected text in a text box.
 o setModified(boolean)
Sets the text box "Modified" property.
 o setMultiLine(boolean)
Determines whether the text box can contain a single line or multiple lines of text.
 o setPasswordCharacter(char)
Determines the password character.
 o setReadOnly(boolean)
Determines whether the text box is read only.
 o setText(String)
Sets the text in a text box.

Variables

 o _changeVector
  protected EventListenerVector _changeVector

Constructors

 o TextBox
  public TextBox()

Methods

 o addChangeListener
  public synchronized void addChangeListener(ChangeListener l)
 o getChangeListeners
  public synchronized EventListenerVector getChangeListeners()
 o handleChange
  public synchronized void handleChange(ChangeEvent data)
 o removeChangeListener
  public synchronized void removeChangeListener(ChangeListener l)
 o getCaretPosition
  public int getCaretPosition()
Gets the position of the insertion caret in the text box.
Returns:
The position of the caret. Position 0 is before the first character.
See Also:
setCaretPosition, getEditSelection, setEditSelection, getText, setText, insertText
 o setCaretPosition
  public void setCaretPosition(int position)
Sets the position of the insertion caret in the text box.

Notes: The current selection, if any, is discarded.

Parameters:
position - The position of the caret. Position 0 is before the first character.
See Also:
getCaretPosition, getEditSelection, setEditSelection, getText, setText, insertText
 o getEditSelection
  public synchronized Range getEditSelection()
Determines the selected text in a text box.

Notes: getEditSelection returns a Range object containing the indices of the first and last characters of the current selection.

Returns:
The zero-based index Range of selected characters.
See Also:
setEditSelection, appendText, insertText, getCaretPosition, setCaretPosition, getText, setText
 o setEditSelection
  public synchronized void setEditSelection(Range r)
Sets the selected text in a text box.
Parameters:
selection - Specifies the characters to select. Use the zero-based index of the first and last selected characters.
See Also:
getEditSelection, appendText, insertText, getCaretPosition, setCaretPosition, getText, setText
 o getLineCount
  public int getLineCount()
Determines the number of lines of text in a text box.
Returns:
The number of lines in the text box, or -1 if an error occurs.
See Also:
getMultiLine, setMultiLine, getText, setText
 o getModified
  public boolean getModified()
Determines whether the text box has been modified.
Returns:
true if the text box has been modified; false if not.
See Also:
setModified, getText, setText
 o setModified
  public void setModified(boolean modified)
Sets the text box "Modified" property.
Parameters:
modified - true the text box has been modified; false the text box has not been modified.
See Also:
getModified, getText, setText
 o getPasswordCharacter
  public char getPasswordCharacter()
Retrieves the password character.

Notes: PasswordCharacter applies only in single line mode.

Returns:
The current password character or '\0' if none.
See Also:
setPasswordCharacter
 o setPasswordCharacter
  public void setPasswordCharacter(char ch)
Determines the password character.

Notes: PasswordCharacter applies only in single line mode.

Parameters:
ch - Specifies the password character.
See Also:
getPasswordCharacter
 o getMultiLine
  public boolean getMultiLine()
Determines whether the text box can contain a single line or multiple lines of text.
Returns:
true if the text box is a multiline text box.
See Also:
setMultiLine, getText, setText
 o setMultiLine
  public synchronized void setMultiLine(boolean multi)
Determines whether the text box can contain a single line or multiple lines of text.
Parameters:
multi - If true, the text box can contain more than one line of text. If false, the text box can contain no more than one line of text.
See Also:
getMultiLine, getText, setText
 o getReadOnly
  public boolean getReadOnly()
Determines whether the text box is read only.
Returns:
true if the text box is read only (i.e., it cannot be modified); false if the text box is read/write.
See Also:
setReadOnly, getText, setText
 o setReadOnly
  public synchronized void setReadOnly(boolean readonly)
Determines whether the text box is read only.
Parameters:
readonly - true means the text box is read only (i.e., it may not be modified); false if the text box is read/write.
See Also:
getReadOnly, getText, setText
 o getSelectedText
  public synchronized String getSelectedText()
Returns the selected portion of text in a text box.
Returns:
The selected portion of the text in a text box.
See Also:
getText, setText
 o getText
  public String getText()
Returns the text in a text box.
Returns:
The text in a text box.
Overrides:
getText in class Component
See Also:
setText
 o setText
  public synchronized void setText(String text)
Sets the text in a text box.
Parameters:
text - The text to set in a text box.
Overrides:
setText in class Component
See Also:
getText
 o getText
  public String getText(int line)
Returns the text for a specified line in a multiline text box.
Parameters:
line - Zero-based index of the line whose text is to be retrieved.
Returns:
The text of the specified line in a text box. If the specified line index exceeds the number of lines in the text box, null is returned.
See Also:
setText
 o getTextLength
  public int getTextLength(int line)
Returns the length of the text for a specified line in a multiline text box.
Parameters:
line - Zero-based index of the line whose length is to be returned.
Returns:
The length of the text for the specified line in a text box. If the specified line index exceeds the number of lines in the text box, -1 is returned.
See Also:
getText
 o appendText
  public void appendText(String text)
Appends text to the text in a text box.
Parameters:
text - The text to be appended to the text in a text box.
See Also:
setText, insertText
 o clear
  public void clear()
Clears text from a text box.

Notes: The same thing can be accomplished with setText( "" ).

See Also:
getText, setText
 o insertText
  public void insertText(String text)
Inserts text at the current position. If text is currently selected, it is replaced.
Parameters:
text - The text to be inserted into the text in a text box.
See Also:
setText, appendText
 o lineIndex
  public int lineIndex(int position)
Returns the zero-based line index of the line in a multiline text box containing the n'th token.
Parameters:
Position - The token number (1,2,...).
Returns:
The index of the line in a multiline text box containing the specified token. If the text box is empty, 0 is returned.
See Also:
getText, getLineCount
 o createAWTComponent
  protected Component createAWTComponent(Component parent)
Overrides:
createAWTComponent in class Component
 o processAWTEvent
  public boolean processAWTEvent(Event event)
Overrides:
processAWTEvent in class Component
 o recreate
  protected boolean recreate()
 o getTokenizedText
  protected StringTokenizer getTokenizedText()

All Packages  Class Hierarchy  This Package  Previous  Next  Index