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
-
_changeVector
-
-
TextBox()
-
-
addChangeListener(ChangeListener)
-
-
appendText(String)
- Appends text to the text in a text box.
-
clear()
- Clears text from a text box.
-
createAWTComponent(Component)
-
-
getCaretPosition()
- Gets the position of the insertion caret in the text box.
-
getChangeListeners()
-
-
getEditSelection()
- Determines the selected text in a text box.
-
getLineCount()
- Determines the number of lines of text in a text box.
-
getModified()
- Determines whether the text box has been modified.
-
getMultiLine()
- Determines whether the text box can contain a single line or
multiple lines of text.
-
getPasswordCharacter()
- Retrieves the password character.
-
getReadOnly()
- Determines whether the text box is read only.
-
getSelectedText()
- Returns the selected portion of text in a text box.
-
getText()
- Returns the text in a text box.
-
getText(int)
- Returns the text for a specified line in a multiline text box.
-
getTextLength(int)
- Returns the length of the text for a specified line in a
multiline text box.
-
getTokenizedText()
-
-
handleChange(ChangeEvent)
-
-
insertText(String)
- Inserts text at the current position.
-
lineIndex(int)
- Returns the zero-based line index of the line in a multiline
text box containing the n'th token.
-
processAWTEvent(Event)
-
-
recreate()
-
-
removeChangeListener(ChangeListener)
-
-
setCaretPosition(int)
- Sets the position of the insertion caret in the text box.
-
setEditSelection(Range)
- Sets the selected text in a text box.
-
setModified(boolean)
- Sets the text box "Modified" property.
-
setMultiLine(boolean)
- Determines whether the text box can contain a single line or
multiple lines of text.
-
setPasswordCharacter(char)
- Determines the password character.
-
setReadOnly(boolean)
- Determines whether the text box is read only.
-
setText(String)
- Sets the text in a text box.
_changeVector
protected EventListenerVector _changeVector
TextBox
public TextBox()
addChangeListener
public synchronized void addChangeListener(ChangeListener l)
getChangeListeners
public synchronized EventListenerVector getChangeListeners()
handleChange
public synchronized void handleChange(ChangeEvent data)
removeChangeListener
public synchronized void removeChangeListener(ChangeListener l)
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
clear
public void clear()
- Clears text from a text box.
Notes:
The same thing can be accomplished with setText( "" )
.
- See Also:
- getText, setText
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
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
createAWTComponent
protected Component createAWTComponent(Component parent)
- Overrides:
- createAWTComponent in class Component
processAWTEvent
public boolean processAWTEvent(Event event)
- Overrides:
- processAWTEvent in class Component
recreate
protected boolean recreate()
getTokenizedText
protected StringTokenizer getTokenizedText()
All Packages Class Hierarchy This Package Previous Next Index