|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.TextComponent
TextComponent
class is the superclass of
any component that allows the editing of some text.
A text component embodies a string of text. The
TextComponent
class defines a set of methods
that determine whether or not this text is editable. If the
component is editable, it defines another set of methods
that supports a text insertion caret.
In addition, the class defines methods that are used to maintain a current selection from the text. The text selection, a substring of the component's text, is the target of editing operations. It is also referred to as the selected text.
Field Summary | |
protected TextListener | textListener
|
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT |
Method Summary | |
void | addTextListener(TextListener l)
Adds the specified text event listener to recieve text events from this textcomponent. |
int | getCaretPosition()
Gets the position of the text insertion caret for this text component. |
String | getSelectedText()
Gets the selected text from the text that is presented by this text component. |
int | getSelectionEnd()
Gets the end position of the selected text in this text component. |
int | getSelectionStart()
Gets the start position of the selected text in this text component. |
String | getText()
Gets the text that is presented by this text component. |
boolean | isEditable()
Indicates whether or not this text component is editable. |
protected String | paramString()
Returns the parameter string representing the state of this text component. |
protected void | processEvent(AWTEvent e)
Processes events on this textcomponent. |
protected void | processTextEvent(TextEvent e)
Processes text events occurring on this text component by dispatching them to any registered TextListener objects. |
void | removeNotify()
Removes the TextComponent's peer. |
void | removeTextListener(TextListener l)
Removes the specified text event listener so that it no longer receives text events from this textcomponent |
void | select(int selectionStart,
int selectionEnd)
Selects the text between the specified start and end positions. |
void | selectAll()
Selects all the text in this text component. |
void | setCaretPosition(int position)
Sets the position of the text insertion caret for this text component. |
void | setEditable(boolean b)
Sets the flag that determines whether or not this text component is editable. |
void | setSelectionEnd(int selectionEnd)
Sets the selection end for this text component to the specified position. |
void | setSelectionStart(int selectionStart)
Sets the selection start for this text component to the specified position. |
void | setText(String t)
Sets the text that is presented by this text component to be the specified text. |
Methods inherited from class java.lang.Object | |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait |
Field Detail |
protected transient TextListener textListener
Method Detail |
public void removeNotify()
public void setText(String t)
t
- the new text.getText()
public String getText()
setText(java.lang.String)
public String getSelectedText()
select(int, int)
public boolean isEditable()
true
if this text component is
editable; false
otherwise.setEditable(boolean)
public void setEditable(boolean b)
If the flag is set to true
, this text component
becomes user editable. If the flag is set to false
,
the user cannot change the text of this text component.
t
- a flag indicating whether this text component
should be user editable.isEditable()
public int getSelectionStart()
setSelectionStart(int)
,
getSelectionEnd()
public void setSelectionStart(int selectionStart)
selectionStart
that is out of bounds, the method enforces these constraints
silently, and without failure.
selectionStart
- the start position of the
selected text.getSelectionStart()
,
setSelectionEnd(int)
public int getSelectionEnd()
setSelectionEnd(int)
,
getSelectionStart()
public void setSelectionEnd(int selectionEnd)
selectionEnd
that is out of bounds, the method enforces these constraints
silently, and without failure.
selectionEnd
- the end position of the
selected text.getSelectionEnd()
,
setSelectionStart(int)
public void select(int selectionStart, int selectionEnd)
This method sets the start and end positions of the selected text, enforcing the restriction that the end position must be greater than or equal to the start position. The start position must be greater than zero, and the end position must be less that or equal to the length of the text component's text. If the caller supplies values that are inconsistent or out of bounds, the method enforces these constraints silently, and without failure.
selectionStart
- the start position of the
text to select.
selectionEnd
- the end position of the
text to select.setSelectionStart(int)
,
setSelectionEnd(int)
,
selectAll()
public void selectAll()
public void setCaretPosition(int position)
position
- the position of the text insertion caret.position
is less than zero.public int getCaretPosition()
public void addTextListener(TextListener l)
l
- the text event listenerpublic void removeTextListener(TextListener l)
protected void processEvent(AWTEvent e)
e
- the eventprotected void processTextEvent(TextEvent e)
e
- the text eventComponent.enableEvents(long)
protected String paramString()
|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |