The abstract TextComponent class provides the base class for the text input components, TextArea and TextField.
public abstract class java.awt.TextComponent extends java.awt.Component { // Instance Methods public void addTextListener (TextListener l); public int getCaretPosition(); public synchronized String getSelectedText(); public synchronized int getSelectionEnd(); public synchronized int getSelectionStart(); public synchronized String getText(); public boolean isEditable(); public void removeNotify(); public void removeTextListener (TextListener l); public synchronized void select (int selectionStart, int selectionEnd); public synchronized void selectAll(); public void setCaretPosition (int position); public synchronized void setEditable (boolean state); public synchronized void setSelectionEnd (int selectionEnd); public synchronized void setSelectionStart (int selectionStart); public synchronized void setText (String text); // Protected Instance Methods protected String paramString(); protected void processEvent (AWTEvent e); protected void processTextEvent (TextEvent e); }
An object that implements the TextListener interface.
Add a listener for the text events.
The position, in characters, of the caret (text cursor).
The currently selected text of the TextComponent.
The ending cursor position of any selected text.
The initial position of any selected text.
Current contents of the TextComponent.
true if editable, false otherwise.
Destroys the peer of the TextComponent.
One of this TextComponent's TextListeners.
Remove a text event listener.
Beginning position of text to select.
Ending position of text to select.
Selects text in the TextComponent.
Selects all the text in the TextComponent.
The new character position for the caret.
If position is less than zero.
Allows you to change the location of the caret.
true to allow the user to edit the text in the TextComponent; false to prevent editing.
Allows you to make the TextComponent editable or read-only.
The character position of the end of the selection.
Allows you to change the location of the end of the selected text.
The character position of the start of the selection.
Allows you to change the location of the start of the selected text.
New text for TextComponent.
Sets the content of the TextComponent.
String with current settings of TextComponent.
Component.paramString()
Helper method for toString() to generate string of current settings.
The event to process.
Low-level AWTEvents are passed to this method for processing.
The event to process.
Text events are passed to this method for processing. Normally, this method is called by processEvent().
Component, TextArea, TextField, String
This HTML Help has been published using the chm2web software. |