All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.TextComponent
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.TextComponent
- public class TextComponent
- extends Component
A TextComponent is a component that allows the editing of some text.
-
getCaretPosition()
- Returns the position of the text insertion caret for the
text component.
-
getSelectedText()
- Returns the selected text contained in this TextComponent.
-
getSelectionEnd()
- Returns the selected text's end position.
-
getSelectionStart()
- Returns the selected text's start position.
-
getText()
- Returns the text contained in this TextComponent.
-
isEditable()
- Returns the boolean indicating whether this TextComponent is
editable or not.
-
paramString()
- Returns the String of parameters for this TextComponent.
-
removeNotify()
- Removes the TextComponent's peer.
-
select(int, int)
- Selects the text found between the specified start and end locations.
-
selectAll()
- Selects all the text in the TextComponent.
-
setCaretPosition(int)
- Sets the position of the text insertion caret for the TextComponent
-
setEditable(boolean)
- Sets the specified boolean to indicate whether or not this
TextComponent should be editable.
-
setSelectionEnd(int)
- Sets the selection end to the specified position.
-
setSelectionStart(int)
- Sets the selection start to the specified position.
-
setText(String)
- Sets the text of this TextComponent to the specified text.
removeNotify
public void removeNotify()
- Removes the TextComponent's peer. The peer allows us to modify
the appearance of the TextComponent without changing its
functionality.
- Overrides:
- removeNotify in class Component
setText
public synchronized void setText(String t)
- Sets the text of this TextComponent to the specified text.
- Parameters:
- t - the new text to be set
- See Also:
- getText
getText
public synchronized String getText()
- Returns the text contained in this TextComponent.
- See Also:
- setText
getSelectedText
public synchronized String getSelectedText()
- Returns the selected text contained in this TextComponent.
- See Also:
- setText
isEditable
public boolean isEditable()
- Returns the boolean indicating whether this TextComponent is
editable or not.
- See Also:
- setEditable
setEditable
public synchronized void setEditable(boolean b)
- Sets the specified boolean to indicate whether or not this
TextComponent should be editable.
- Parameters:
- b - the boolean to be set
- See Also:
- isEditable
getSelectionStart
public synchronized int getSelectionStart()
- Returns the selected text's start position.
setSelectionStart
public synchronized void setSelectionStart(int selectionStart)
- Sets the selection start to the specified position. The new
starting point is constrained to be before or at the current
selection end.
- Parameters:
- selectionStart - the start position of the text
getSelectionEnd
public synchronized int getSelectionEnd()
- Returns the selected text's end position.
setSelectionEnd
public synchronized void setSelectionEnd(int selectionEnd)
- Sets the selection end to the specified position. The new
end point is constrained to be at or after the current
selection start.
- Parameters:
- selectionEnd - the start position of the text
select
public synchronized void select(int selectionStart,
int selectionEnd)
- Selects the text found between the specified start and end locations.
- Parameters:
- selectionStart - the start position of the text
- selectionEnd - the end position of the text
selectAll
public synchronized void selectAll()
- Selects all the text in the TextComponent.
setCaretPosition
public void setCaretPosition(int position)
- Sets the position of the text insertion caret for the TextComponent
- Parameters:
- position - the position
- Throws: IllegalArgumentException
- If position is less than 0.
getCaretPosition
public int getCaretPosition()
- Returns the position of the text insertion caret for the
text component.
- Returns:
- the position of the text insertion caret for the text component.
paramString
protected String paramString()
- Returns the String of parameters for this TextComponent.
- Overrides:
- paramString in class Component
All Packages Class Hierarchy This Package Previous Next Index